Closed stamblerre closed 4 years ago
@stamblerre I was seeing this dialog for a little bit, but now it's not popping up at all and gopls
seems to be ... napping?
I'm seeing this error in the logs:
[Error - 5:05:20 p.m.] 2020/04/16 17:05:20 failed to load workspace packages, skipping diagnostics: github.com/myorg/myproject/api/model has no metadata
snapshot=10087
directory=file:///Users/hairyhenderson/go/src/github.com/myorg/myproject
I did delete the api/model
directory (with a git rm
command in a shell), but it appears something went out of sync and thinks that directory is still around?
That's definitely possible - thanks for the report @hairyhenderson. I'll add a regression test for this case (https://github.com/golang/go/issues/38407#issuecomment-614938365). Ctrl + Shift + P
-> Go: Restart Language Server
should fix it temporarily.
@stamblerre thanks! That's a super-helpful shortcut! I usually just ps -eaf | grep gopls
and kill one at random until the right one restarts π
That's definitely possible - thanks for the report @hairyhenderson. I'll add a regression test for this case (golang/go#38407 (comment)).
Ctrl + Shift + P
->Go: Restart Language Server
should fix it temporarily.
It doesn't work for me. When I Ctrl + Shift + P
-> Go: Restart Language Server
, Nothing happen and there is no code hintting any more, though I wait a long time. Finally I have to restart vscode.
By the way, I got gopls error message:
[Info - δΈε11:41:17] 2020/05/07 11:41:17 go/packages.Load
snapshot=0
directory=D:\Documents\my_projects\learn_micro
query=[./... builtin]
packages=17
[Error - δΈε11:41:18] Request textDocument/foldingRange failed.
Message: invalid pos
Code: 0
[Error - δΈε11:41:18] 2020/05/07 11:41:18 DocumentSymbols failed: invalid pos
URI=file:///D:/Documents/my_projects/learn_micro/grpcConsulDemo/simpleClient_test.go
[Error - δΈε11:57:02] Request textDocument/foldingRange failed.
Message: invalid pos
Code: 0
[Error - δΈε11:57:02] 2020/05/07 11:57:02 DocumentSymbols failed: invalid pos
URI=file:///D:/Documents/my_projects/learn_micro/grpcConsulDemo/simpleClient_test.go
[Error - δΈε11:57:02] Request textDocument/codeAction failed.
Message: computing fix edits: D:\Documents\my_projects\learn_micro\grpcConsulDemo\simpleClient_test.go:16:6: expected operand, found ',' (and 9 more errors)
Code: 0
[Error - δΈε11:57:02] Request textDocument/codeAction failed.
Message: computing fix edits: D:\Documents\my_projects\learn_micro\grpcConsulDemo\simpleClient_test.go:16:6: expected operand, found ',' (and 9 more errors)
Code: 0
[Error - δΈε11:57:02] Request textDocument/formatting failed.
Message: 16:6: expected operand, found ',' (and 2 more errors)
Code: 0
[Error - δΈε11:57:02] Request textDocument/codeAction failed.
Message: computing fix edits: D:\Documents\my_projects\learn_micro\grpcConsulDemo\simpleClient_test.go:16:6: expected operand, found ',' (and 9 more errors)
Code: 0
I know I have syntax error in my code, that not the key, the key point is, the Saving 'main.go': Getting code actions from ''Go', 'Go'' (configure).
takes too much time.
@Wisgon: If you add
"go.languageServerFlags": [
"-rpc.trace"
]
to your VS Code settings, it should give you more detailed information. However, if your project is very large / has a lot of dependencies, it's possible that something else is going wrong.
Restarting the language server didn't do anything for me, but @onlyafly 's recommendation to downgrade the Go extension to 0.13.1 solved the issue completely
Things I tried:
@bobheadxi: This error usually starts happening when there is some misconfiguration or issue with gopls
. Please take a look at the first comment on this issue (https://github.com/microsoft/vscode-go/issues/3179#issue-600430641) for advice on how to troubleshoot this.
Going to close this issue, as I haven't heard of many people encountering this recently.
If you encounter this issue, please try the following steps to troubleshoot:
gopls
to be slow. Capture yourgopls
logs and post them here (if you're able to share them). Detailedgopls
logs are best, so please add the-rpc.trace
togo.languageServerFlags
.For reference, this bug is referring to an error that appears like this:
This issue consolidates https://github.com/microsoft/vscode-go/issues/3063, https://github.com/microsoft/vscode-go/issues/3105, https://github.com/microsoft/vscode-go/issues/3141, https://github.com/microsoft/vscode-go/issues/3170, etc.