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
Closed

Comments

@stamblerre
Copy link
Contributor

@stamblerre 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
@stamblerre stamblerre added the NeedsFix label Oct 28, 2020
@stamblerre
Copy link
Contributor Author

@stamblerre stamblerre commented Oct 30, 2020

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

@stamblerre stamblerre commented Nov 13, 2020

Closing in favor of #40599.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.