-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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/internal/lsp: completion works only when typing first character #30796
Comments
(OT) @stamblerre can you confirm that the new lsp issue label is spelled correctly? It's |
@ALTree it should be |
Ah, my bad. You're right. I also just noticed the wiki page is at https://github.com/golang/go/wiki/gopls too. I was thinking about Sorry for the noise. |
After debugging a bit I found that this issue is due to TextEdit https://github.com/golang/tools/blob/master/internal/lsp/completion.go#L40 If I remove TextEdit from completion item then it works. |
@anjmao: thanks for investigating - it's really interesting that TextEdit is the problem, since as far as I know, InsertText is deprecated in favor of TextEdit (https://microsoft.github.io/language-server-protocol/specification#textDocument_completion). I'll look into this further. |
Change https://golang.org/cl/167457 mentions this issue: |
InsertText is deprecated, and it seems that providing both InsertText and TextEdits causes unexpected behavior from VSCode. Avoid this by providing only TextEdits. Fixes golang/go#30796 Change-Id: Ieb5ad2fecd6f7083a4c1bc402634893c7e6ff49f Reviewed-on: https://go-review.googlesource.com/c/tools/+/167457 Reviewed-by: Ian Cottrell <iancottrell@google.com> Run-TryBot: Rebecca Stambler <rstambler@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
What version of Go are you using (
go version
)?Hi, just tried newest gopls version.
Typing
s
shows completion items and string is suggestedTyping
st
shows no completion suggestions but should suggest stringMy findings
I'm using vscode with gopls. What I noticed is that Completion handler is called only once and until completion popup is visible no more calls are made for completion, this is why completion is not updated. DidChange handler is working fine and called on every character input.
By following vscode language client-server tutorial https://code.visualstudio.com/api/language-extensions/language-server-extension-guide I can see that completion is triggered only once (while completion menu with suggested items is shown) for performance reasons and client does filtering, but for some reasons this doesn't work for gopls and vscode-go. Do you have any ideas that is the problem here?
/cc @stamblerre
The text was updated successfully, but these errors were encountered: