Skip to content

x/tools/gopls: option to exclude vendor from suggested symbols or symbols from vendored tools #73493

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

Open
hu3bi opened this issue Apr 24, 2025 · 0 comments
Labels
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

@hu3bi
Copy link

hu3bi commented Apr 24, 2025

Is your feature request related to a problem? Please describe.

Right now, you can set the following preference only to workspace or all.

"gopls": {
        "ui.navigation.symbolScope": "workspace",
}

symbolScope controls which packages are searched for workspace/symbol requests. When the scope is "workspace", gopls searches only workspace packages. When the scope is "all", gopls searches all loaded packages, including dependencies and the standard library.

workspace: "workspace" matches symbols in workspace packages only.

This can be inconvenient, excluding a vendor directory from symbol indexing also prevents symbols from the standard library from being suggested, which is undesirable behavior.
Especially frustrating in combination with the new go tool directive.
Having the following in the go.mod suggests a lot of symbols from my tools as well.

tool (
	github.com/a-h/templ/cmd/templ
	github.com/air-verse/air
	go.uber.org/nilaway/cmd/nilaway
	golang.org/x/tools/cmd/deadcode
	golang.org/x/tools/cmd/godoc
	golang.org/x/vuln/cmd/govulncheck
	mvdan.cc/gofumpt
)

Describe the solution you'd like
Add a 3rd property, that searches all loaded packages, including dependencies, the standard library but excluding vendor.

Describe alternatives you've considered
Option to pass in an array of properties of what should be matched.

Available properties would have to be determined.

Example:

"gopls": {
        "ui.navigation.symbolScope": [
                 "std-lib",
                 "vendor",
                 "tools",  // ⇐ don't really think anyone would want that
                 "workspace",
                 ...
}

Additional context
Add any other context or screenshots about the feature request here.

@h9jiang h9jiang transferred this issue from golang/vscode-go Apr 24, 2025
@seankhliao seankhliao changed the title option to exclude vendor from suggested symbols or symbols from vendored tools x/tools/gopls: option to exclude vendor from suggested symbols or symbols from vendored tools Apr 24, 2025
@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 Apr 24, 2025
@gopherbot gopherbot added this to the Unreleased milestone Apr 24, 2025
@h9jiang h9jiang modified the milestones: Unreleased, gopls/backlog Apr 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

3 participants