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

x/tools/gopls: add a setting to ignore certain directories #42473

Closed
stamblerre opened this issue Nov 10, 2020 · 1 comment
Closed

x/tools/gopls: add a setting to ignore certain directories #42473

stamblerre opened this issue Nov 10, 2020 · 1 comment
Labels
FrozenDueToAge gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@stamblerre
Copy link
Contributor

We've discussed this throughout the implementation of the workspace module mode--a setting that allows users to ignore certain directories when we look for modules.

@stamblerre stamblerre added this to the gopls/vscode-go milestone Nov 10, 2020
@gopherbot gopherbot added Tools This label describes issues relating to any tools in the x/tools repository. gopls Issues related to the Go language server, gopls. labels Nov 10, 2020
@findleyr findleyr assigned findleyr and unassigned findleyr Nov 10, 2020
@stamblerre stamblerre moved this from Critical to Needs Triage in vscode-go: gopls by default Nov 10, 2020
@stamblerre stamblerre moved this from Needs Triage to Critical in vscode-go: gopls by default Nov 10, 2020
@gopherbot
Copy link

Change https://golang.org/cl/275253 mentions this issue: internal/lsp: support directory inclusion/exclusion filters

@stamblerre stamblerre moved this from Critical to In progress in vscode-go: gopls by default Dec 6, 2020
vscode-go: gopls by default automation moved this from In progress to Done Dec 8, 2020
marwan-at-work pushed a commit to marwan-at-work/tools that referenced this issue Dec 23, 2020
Users working in large repositories may want to include only selected
directories in their workspace to avoid memory usage and performance
slowdowns. Add support for inclusion/exclusion filters that control what
directories are searched for workspace packages and modules. Packages
that are excluded by the filter may still be loaded as non-workspace
packages if other things depend on them.

For a description of the option's syntax, see the documentation.

Note that because we don't have any way to communicate the filters to
packages.Load, we still run go list on the unfiltered workspace scope,
then throw away the irrelevant packages. That may cost us, especially in
workspaces with many files.

Comments on the naming welcome. Also, if you know any places I may have
missed applying the filter, please do tell. One thing I thought of is
file watching, but that's covered because allKnownSubdirs works off of
workspace files and those are already filtered.

Possible enhancements:
 - Support glob patterns.
 - Apply filters during the goimports scan.
 - Figure out how to apply the filters to packages.Load. I don't know
 how to do it while still being build system neutral though.

Closes golang/go#42473, assuming none of the enhancements are required.

Change-Id: I9006a7a361dc3bb3c11f78b05ff84981813035a0
Reviewed-on: https://go-review.googlesource.com/c/tools/+/275253
Trust: Heschi Kreinick <heschi@google.com>
Run-TryBot: Heschi Kreinick <heschi@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
@golang golang locked and limited conversation to collaborators Dec 8, 2021
@rsc rsc unassigned heschi Jun 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository.
Projects
No open projects
Development

No branches or pull requests

4 participants