-
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/gopls: completion fails for incomplete function literal parameter types #36479
Comments
This is no longer an issue, can you can confirm @seh? See the below screenshot |
I find that if I start with just the opening parenthesis character like this, return func(c *co<> then the completion suggestions work as expected. However, if I allow my editor's insertion of balanced delimiters to proceed, such that I start with the closing parenthesis in place, return func(c *co<>) then completion fails when gopls reports the following error:
That looks like an error from staticcheck's "Poorly chosen receiver name" check. [Time passes ...] If I watch the output of gopls as I add and remove characters around the statement shown above, I see lots of failures out of statichceck for other checks like the following:
|
The staticcheck errors are actually unrelated to the completion results. These are errors logged by |
In the *lsp-log* buffer, every time I type a character in the position shown above, I see a message like the following:
I can't find any other output that seems related. |
Interesting, this is the scenario I tried to reproduce too. You can actually see the closing parenthesis in my image. |
This could be due to a bunch of other Emacs packages just being too old. I'm using Aquamacs version 3.5, built atop Emacs version 25.3.50.1, which holds back from being able to update some packages that have declared that they don't work on anything older than Emacs 26. If you can't reproduce the problem and wish to move on, I can accept that. Aquamacs may finally leap forward again in the coming months, and then all of this might just work itself out. |
If you can increase the verbosity of your logs, we can continue troubleshooting: https://github.com/golang/tools/blob/master/gopls/doc/troubleshooting.md#capture-logs. However, it is possible that there is some issue with caused by Emacs here. Also, can you please confirm that you are using the latest version of |
Timed out in state WaitingForInfo. Closing. (I am just a bot, though. Please speak up if this is a mistake or you have the requested information.) |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
The version of gopls is fairly recent, as of this writing:
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Using an editor that inserts balanced delimiters—such as a closing parenthesis character after typing an opening parenthesis character—try to complete the function literal parameter type
config
at the cursor position, denoted by<>
here:What did you expect to see?
gopls would respond to the editor's request for completion there, and supply the identifier
config
as a good option.What did you see instead?
gopls stalls for a long while, but never produces any suggestions for completion.
If I delete the closing parenthesis after the
co
above, like this, gopls does offer completion suggestions:Similarly, if I round out more of the function literal, and move the cursor back after "co," gopls will offer completion suggestions:
I can see that in various states of being incomplete, this is not yet valid code. However, given the propensity for editors to help us with balanced delimiter insertion, it would be nice to accommodate completion in this situation.
The text was updated successfully, but these errors were encountered: