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

stamblerre opened this issue Nov 10, 2020 · 1 comment

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

stamblerre opened this issue Nov 10, 2020 · 1 comment


Copy link

@stamblerre stamblerre commented Nov 10, 2020

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.

Copy link

@gopherbot gopherbot commented Dec 3, 2020

Change 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 added 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
Trust: Heschi Kreinick <>
Run-TryBot: Heschi Kreinick <>
gopls-CI: kokoro <>
TryBot-Result: Go Bot <>
Reviewed-by: Rebecca Stambler <>
Reviewed-by: Robert Findley <>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
No open projects
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants