x/tools/cmd/gopls: Error on completion when defining identifiers #30966
Labels
FrozenDueToAge
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.
Milestone
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?
I'm currently using neovim / LanguageClient-neovim, although the issue should reproduce in any editor. To reproduce, trigger text completion when defining an identifier.
For example:
Trigger completion at the end of the file, after
ba
.Alternatively:
With similar results for
const ba
,var ba
, etc.What did you expect to see?
gopls
should have no errors and return no completion items. Althoughgopls
will be unable provide suggestions, this is expected since a new identifier is being defined. There is not really any exception or error that has occurred.This is particularly relevant for clients which attempt to provide completion items automatically, since the client will be regularly requesting completions during identifier definitions.
What did you see instead?
An error with the message
"this is a definition, of func ba(func(invalid type))"
, or"this is a definition, of type ba invalid type"
, etc.The error is being returned here: https://github.com/golang/tools/blob/36c10c0a621fb2fede4686e8ae7bb1d900735d53/internal/lsp/source/completion.go#L140
The text was updated successfully, but these errors were encountered: