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
"Go: Add Import" does not work with gopls v0.6.11 #1549
Comments
Oh no, this is an unfortunate sequence of events. I added the stub command and then Marwan filled it in. For commands in particular we could have some kind of marker saying "this command is not ready yet", but that might be overfitting the solution. Is it worth patching VS Code to hard-code the gopls version for these commands to 0.7.0? |
Change https://golang.org/cl/326712 mentions this issue: |
The situation was more complicated than I initially thought. I tried to summarize
|
v0.26.0 will go out without this fix. |
I think until gopls is 1.0, it's been pretty common, at least personally, to frequently upgrade gopls so I'm in favor of that option and I agree that Add Import is not as common as other features. Thank you! |
We decided not to fix this issue. |
https://go-review.googlesource.com/c/vscode-go/+/322169 uses
gopls
as a backend forGo: Add Import" command, and the
gopls.list_known_packagescommand is available only after gopls v0.7.0 (not yet released). The idea was that first the extension tries to run gopls command, and if the command fails (because gopls is old ), the extension tries the old
implbased backend. But it turned out
gopls` v0.6.11 doesn't seem to return an error but an empty packages list. As a result, the command fails to show any candidates packages. @marwan-at-workThe following is the log with 'v0.6.11'.
I was about to propose to check the
initialize
response and see if thegopls.list_known_package
is available for use. But, unfortunately, it turned out the command is available in v0.6.11. But I guess v0.6.11 was released with partial implementation.gopls v0.7.0 release is very close so I think the easiest workaround here is to tell users to update gopls.
Another option (for users who can't update to gopls v0.7.0+ right now) is to treat the empty result as an error and trigger fallback.
p.s. @stamblerre @findleyr is there any way to prevent this type of partial feature rollout in the future? (e.g. requires clients to opt in during the partial implementation period, etc).
The text was updated successfully, but these errors were encountered: