x/tools/gopls: Code completion in gopls is not working, unable to find the packages to import #71462
Labels
gopls
Issues related to the Go language server, gopls.
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
ToolProposal
Issues describing a requested change to a Go tool or command-line program.
Tools
This label describes issues relating to any tools in the x/tools repository.
Milestone
What did you do?
I have enabled gopls in Neovim through configuring lspconfig. When I am working in a new project and type
http
, gopls does not provide code completion suggestions fornet/http
. And this issue is not limited to thehttp
module, it affects all modules.I have noticed that when I manually add import
net/http
to the import block, the code completion starts to work properly, and it also begins to suggest other modules correctly.I guess that maybe gopls only indexes the modules in the import block and does not index the standard library or the modules listed in go.mod by default. I believe this is not the expected behavior. I think indexing the standard library and the modules in go.mod should be considered an expected behavior.
What did you expect to see?
Neovim should provide suggestions for packages that have not yet been imported, such as directly using
http
in a new project as I mentioned earlier.What did you see instead?
Neovim does not suggest packages that have not yet been imported.
Build info
The text was updated successfully, but these errors were encountered: