Skip to content
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

codelens: go mod tidy or some gopls provided codelenses can fail with cryptic error popups #1237

Closed
hyangah opened this issue Feb 18, 2021 · 2 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@hyangah
Copy link
Contributor

hyangah commented Feb 18, 2021

Some commands run by gopls require all changes in buffer to be saved. Otherwise they return errors.
The error details are not currently visible unless users inspect the gopls (server) output channel.
Instead vscode will pop up rather cryptic error messages.

Screen Shot 2021-02-18 at 9 16 01 AM

This is related to the upstream bug reports microsoft/vscode#116932 and microsoft/vscode#116953

Here is the LSP trace.

[Trace - 09:15:50.467 AM] Sending request 'workspace/executeCommand - (124)'.
Params: {"command":"gopls.tidy","arguments":[{"URIs":["file:///Users/hakim/projects/google/w/go.mod"]}]}

[Error - Received] 09:15:50.468 AM #124 All files must be saved first

[Error - 9:15:50 AM] Request workspace/executeCommand failed.
  Message: All files must be saved first
  Code: 0 

Would be nice if VS Code & vscode-languageclient come up with a solution to surface the error.
If not, some workarounds I can think of are:

  • From middleware, check if all the files are saved and either force to save or show popup for user to save it, or
  • From middleware, surface the error message using a popup and swallow the error (not sure if it's possible), or
  • Let gopls return a popup rather than reporting this as an error.

cc @stamblerre

@hyangah hyangah added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Feb 18, 2021
@gopherbot
Copy link
Collaborator

Change https://golang.org/cl/300389 mentions this issue: src/goLanguageServer: show command failure error messages from gopls

@hyangah
Copy link
Contributor Author

hyangah commented Mar 10, 2021

After:
Screen Shot 2021-03-10 at 10 04 17 AM

Before:
Screen Shot 2021-03-10 at 9 43 23 AM

@hyangah hyangah added this to the v0.23.1 milestone Mar 10, 2021
@golang golang locked and limited conversation to collaborators Mar 10, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

2 participants