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: prefer deep completion results from local variables over packages #42174

Closed
stamblerre opened this issue Oct 23, 2020 · 2 comments
Labels
FrozenDueToAge gopls Issues related to the Go language server, gopls. NeedsFix The path to resolution is known, but the work has not been done. Tools This label describes issues relating to any tools in the x/tools repository.

Comments

@stamblerre
Copy link
Contributor

stamblerre commented Oct 23, 2020

Working in golang.org/x/tools/internal/lsp/diagnostics.go in the errorsToDiagnostic function. e.URI should clearly have been offered as a completion here.

Screen Shot 2020-10-23 at 3 51 27 PM

/cc @heschik

@stamblerre stamblerre added this to the gopls/vscode-go milestone Oct 23, 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 Oct 23, 2020
@stamblerre stamblerre added the NeedsFix The path to resolution is known, but the work has not been done. label Oct 28, 2020
@stamblerre
Copy link
Contributor Author

Digging into this a little more, this seems to be caused by a combination of the limit on deep completion items and scoring.

Here are the scores of all the candidates:

protocol.URI - 0.6825
protocol.URIFromPath - 0.6825
protocol.URIFromSpanURI - 0.6825
e.URI - 0.675675
fh.URI - 0.6142500000000001
equalURISet - 0.5980753056476295
protocol.DocumentURI - 0.455

Note that all of the protocol functions are ranked slightly above e.URI, a depth level 1 completion item from a local variable declared near the completion request. These 3 protocol results are then the 3 items returned for deep completions, causing the e.URI and fh.URI results to be excluded.

@stamblerre stamblerre changed the title x/tools/gopls: broken deep completion x/tools/gopls: missing deep completion Oct 30, 2020
@stamblerre stamblerre changed the title x/tools/gopls: missing deep completion x/tools/gopls: missing deep completion result Oct 30, 2020
@stamblerre stamblerre changed the title x/tools/gopls: missing deep completion result x/tools/gopls: prefer deep completion results from local variables over packages Oct 30, 2020
@stamblerre
Copy link
Contributor Author

Closing in favor of #40599.

@stamblerre stamblerre removed this from the gopls/unplanned milestone Nov 13, 2020
@golang golang locked and limited conversation to collaborators Nov 13, 2021
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. NeedsFix The path to resolution is known, but the work has not been done. Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

2 participants