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: unimported completions offer circular imports #41869

Open
stamblerre opened this issue Oct 8, 2020 · 5 comments
Open

x/tools/gopls: unimported completions offer circular imports #41869

stamblerre opened this issue Oct 8, 2020 · 5 comments
Labels
gopls/completion Issues related to auto-completion in gopls. 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.
Milestone

Comments

@stamblerre
Copy link
Contributor

To reproduce:

Type cache.New inside of golang.org/x/tools/internal/lsp/cache and accept the completion.

Related: #36077.

/cc @heschik

@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 8, 2020
@gopherbot gopherbot added this to the Unreleased milestone Oct 8, 2020
@stamblerre stamblerre removed this from the Unreleased milestone Oct 8, 2020
@stamblerre stamblerre added the NeedsFix The path to resolution is known, but the work has not been done. label Oct 8, 2020
@heschi
Copy link
Contributor

heschi commented Oct 8, 2020

Can't reproduce, with or without experimentalWorkspaceModule. Either way I don't think it's related to #36077. A log might help, but given how opaque the imports code is, I'm not sure :-/

@stamblerre
Copy link
Contributor Author

stamblerre commented Oct 8, 2020

Weird, can't repro in cache anymore because a honnef.co cache package is now outranking it.
Here's a log with source: https://gist.github.com/stamblerre/38f1589eec5c8a5758301835b125f7e3.
Sorry it's really unedited, so it may not be super useful.

@heschi
Copy link
Contributor

heschi commented Oct 9, 2020

The log doesn't include a completion request, so I'm not sure what I'm supposed to be looking at?

@stamblerre
Copy link
Contributor Author

I must've messed it up when I was trying to truncate it. Just updated it.
The easiest thing will probably be to try reproducing yourself. Open up golang.org/x/tools/internal/lsp/source/rename_check.go, and in the first function, type source., and accept whatever the first completion is. This will add an import for golang.org/x/tools/internal/lsp/source.

@heschi
Copy link
Contributor

heschi commented Oct 9, 2020

I still can't reproduce the problem, but the logs were enough. These are typed completions from gopls, not the imports package, and it looks like I completely forgot to add a circular import check to those.

@stamblerre stamblerre added this to the gopls/unplanned milestone Oct 21, 2020
@stamblerre stamblerre added this to To Do in gopls on-deck Feb 28, 2021
@suzmue suzmue added the gopls/completion Issues related to auto-completion in gopls. label May 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gopls/completion Issues related to auto-completion in gopls. 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
No open projects
Development

No branches or pull requests

4 participants