Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Respecting vscode exclude directives. #1739

Open
butuzov opened this issue Sep 1, 2021 · 9 comments
Open

Respecting vscode exclude directives. #1739

butuzov opened this issue Sep 1, 2021 · 9 comments
Assignees
Labels
Duplicate Make it obvious when issues are closed as duplicate FeatureRequest Go Companion Issues relating to the Go Companion extension go-test issues related to go test support (test output, test explorer, ...)

Comments

@butuzov
Copy link
Contributor

butuzov commented Sep 1, 2021

Is your feature request related to a problem? Please describe.
I am having directories in my project consisting of different open-source projects, and I would like gopls not to even look in that direction (as my laptop don't like too much attention to CPU and become pan really fast).

Describe the solution you'd like
vscode-go has few related settings (files.exclude, search.exclude, files.watcherExclude ) maybe vacode-go extension can utilize it?

{
    "files.exclude": {
        ".sandbox/repos-*": true
    },
    "search.exclude": {
        ".sandbox/repos-*": true
    },
    "files.watcherExclude": {
        ".sandbox/repos-*": true
    }
}

Describe alternatives you've considered
May be we can have additional exclude options? (i.e go.exclude)

Additional context
I am working on linter, and running tests on live examples quite fast, my laptop fan isn't a fun of it.

@gopherbot gopherbot added this to the Untriaged milestone Sep 1, 2021
@findleyr findleyr modified the milestones: Untriaged, Backlog Sep 1, 2021
@findleyr
Copy link
Member

findleyr commented Sep 1, 2021

Thanks for the issue.

We've been discussing this problem, and agree that we should do something in this direction.

You may already be aware of the gopls directoryFilters option:
https://github.com/golang/tools/blob/master/gopls/doc/settings.md#directoryfilters-string
You should be able to use that to filter out the directories in question.

We've been debating whether to set a default directoryFilters and/or whether to honor .gitignore'd directories. Considering vscode exclude directives is another option.

@butuzov
Copy link
Contributor Author

butuzov commented Sep 2, 2021

@findleyr indeed I miss this setting while thinking about how to solve the problem. might need to refresh my knowledge of gopls configuration options.

@findleyr
Copy link
Member

findleyr commented Sep 3, 2021

Depending on the outcome of golang/go#46438, we might be able to automatically set directoryFilters based on vscode settings.

@hyangah
Copy link
Contributor

hyangah commented Sep 8, 2021

@firelizzard18 should we consider adding a similar filter for test explorer?

@firelizzard18
Copy link
Contributor

Yes, I think we should

@firelizzard18 firelizzard18 mentioned this issue Sep 8, 2021
12 tasks
@gopherbot
Copy link
Collaborator

Change https://golang.org/cl/351172 mentions this issue: src/goTest: support excluding packages and files

@hyangah hyangah added the go-test issues related to go test support (test output, test explorer, ...) label Jan 26, 2022
@hyangah hyangah removed the Thinking label Mar 25, 2022
@dle8 dle8 added the Duplicate Make it obvious when issues are closed as duplicate label Aug 4, 2022
@greenstatic
Copy link

The linked issue (https://golang.org/cl/351172) mentions that implementation of this feature has been abandoned due to @firelizzard18 not having the time to refactor the initial PR. Is this something that is being worked on currently by any chance? Is this something that I could help push forward? I mentioned a possible solution that seems quite trivial to implement in a separate issue: #2504 (comment). If this is something that is of interest, I can help with the PR.

@firelizzard18
Copy link
Contributor

@greenstatic AFAIK no one is working on this. I have no problem with someone taking this over. As you say, skipping specific folders while walking is pretty easy. Your go.testExplorer.walk.exclude isn't substantially different from my go.testExplorer.exclude.

The complications start showing up when you look at how the driver should behave when settings are changed. As a user I would be rather frustrated if I had to reload VSCode any time I wanted to change the set of excluded paths. If we're going to have a better experience than that, simply skipping paths during walk is not sufficient; you also need to update the tree and potentially rescan some paths when the setting is changed. Of course you could throw away the entire test item tree and rescan it, but that would not perform well, especially for large projects. Plus that could throw away other resources associated with tests, such as CPU/memory profiles, which would add to the frustration.

Thus the vast majority of the complexity comes down to intelligently updating the test item tree when the exclusion list is updated. In my CL, I compare the old list to the new list to generate a diff. For added paths, I look for test items in those paths and destroy them. For removed paths, I track paths that were excluded and rescan them.

@firelizzard18
Copy link
Contributor

This is done in #3523

@firelizzard18 firelizzard18 added the Go Companion Issues relating to the Go Companion extension label Oct 3, 2024
@firelizzard18 firelizzard18 self-assigned this Oct 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Duplicate Make it obvious when issues are closed as duplicate FeatureRequest Go Companion Issues relating to the Go Companion extension go-test issues related to go test support (test output, test explorer, ...)
Projects
Status: Done
Development

No branches or pull requests

7 participants