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: workspace symbols orders external symbols before local module symbols #66523
Comments
In this case, the fact that the local symbol is a method contributes to its ranked below the external symbols. |
Alas, I'm not sure this is fixable. I think we've already implemented these heuristics in gopls and it is VS Code doing its own sorting and fuzzy matching of the results. To prove this, compare the output of
That's the sorting returned by gopls. Does it make more sense? |
It does, the ordering directly from gopls makes sense. So is this occurring in the Go VSCode extension, or in VSCode itself? Where should I re-raise the bug? |
This closed ticket from 2019 does not fill me with confidence. |
Though this comment suggests that there are existing mechanisms for extensions to control completion ordering, though there are a lot of comments to wade through so it's not really clear what they're referring to. |
It seems like this issue should be transferred back to vscode-go? |
VS Code Go already does some hack to preserve the ordering for completion (code), but not for workspace symbol search . Unfortunately, I don't see a way to prevent client-side sorting/filtering for workspace symbols in VS Code API yet. (The linked issue was mostly discussing the completion item ordering if I understand it correctly) https://code.visualstudio.com/api/references/vscode-api#SymbolInformation I think the best path going forward is to open a new issue in the vscode repo. There was a similar issue microsoft/vscode#71951 but from the look, the vscode team took the path to improve their client-side sorting algorithm rather than preserving ordering from the language server. Related: microsoft/vscode#98125 |
What version of Go, VS Code & VS Code Go extension are you using?
Version Information
go version
to get version of Go from the VS Code integrated terminal.gopls -v version
to get version of Gopls from the VS Code integrated terminal.code -v
orcode-insiders -v
to get version of VS Code or VS Code Insiders.Go: Locate Configured Go Tools
command.Share the Go related settings you have added/edited
Run
Preferences: Open Settings (JSON)
command to open your settings.json file.Share all the settings with the
go.
or["go"]
orgopls
prefixes.Describe the bug
"Go to Symbol in Workspace" orders external symbols before local module symbols. I would expect any matching local symbols to always be before external symbols.
Steps to reproduce the behavior:
This seems to repeatable anywhere, but the example is from https://github.com/TBD54566975/ftl. See the screenshot for the symbol I used.
Screenshots or recordings
If applicable, add screenshots or recordings to help explain your problem.
The text was updated successfully, but these errors were encountered: