-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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: don't downrank symbol results outside of the workspace folder, but in a workspace module #63458
Comments
Thanks. That's definitely not right. The scoring algorithm is simple: (1) cue should score higher than Continue, (2) shorter results should score higher than longer. Reproduces with: I'll investigate and fix for v0.14.0. |
This isn't a bug in the scoring algorithm, per se: the fuzzy score of The following specific steps mitigate the problem (but see below -- these steps are too strict):
Then both cue and cuelang.org will be considered "in the workspace", and results will match expectation. But this is confusing for LSP clients without a strong concept of 'workspace folder'. We typically expand the workspace to all main modules (including any specified in go.work). It should be sufficient simply to use a go.work file, and open gopls from any directory. It may also seem tempting to remove this down-ranking of non-workspace packages, but we have heard multiple times that some users don't want any non-workspace results. I think properly respecting |
Just so that I'm clear, are you suggesting I should add the If so, I don't think this is a solution in this case or in general. Because If this downranking is the reason for the "bad" results (from my perspective), then I believe #37237 is the better solution. Because with that approach, no such downranking would be required: I would explicitly be in a mode of searching the current package, the main module, workspace etc. |
I'm not suggesting any action -- I'm simply explaining the current ranking :), and the heuristics behind it. A Yes, #37237 would address this for clients that integrate the new syntax or custom command. |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Open vim/editor, and do a symbol search for
cue.Str
What did you expect to see?
The result for
cuelang.org/go/cue.Str
as the best match.What did you see instead?
cuelang.org/go/cue.Str
as the 13th best match with a number of worse matches scoring higher (highest score first)Logs from my session locally:
cc @findleyr
The text was updated successfully, but these errors were encountered: