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

x/tools/gopls: gc_details codelens is broken because gopls_gc_details command is not included in initialization #41985

hyangah opened this issue Oct 14, 2020 · 2 comments


Copy link

@hyangah hyangah commented Oct 14, 2020

$ gopls -v version
Build info
---------- master h1:lvYvyth3KR9zDdDRWZ6Olt3KNZ5iWVWLJPojDK1Kf0A= h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= h1:JFrFEBb2xKufg6XkJsJr+WbKb4FQlURi5RUcBveYu9k= h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0= h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4= h1:qwRHBd0NqMbJxfbotnDhm2ByMI1Shq4Y6oRJo21SGJA= h1:q80OtYaeeySe8Kqg0vjXehHwj5fUTqe3xOvnbi5w3Gg= h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= h1:nI5egYTGJakVyOryqLs1cQO5dO0ksin5XXs2pspk75k= h1:t8TAw9WgTLghti7RYkpPmqk4JtQ3+wcP5GgZqgWeWLQ= h1:NSZPykBXJFCetGZykLAxaL6SIpvbVy/UFEniIfHAa8A=
$ gopls api-json | jq
      "Command": "gc_details",
      "Title": "Toggle gc_details",
      "Doc": "gc_details controls calculation of gc annotations.\n"
      "Lens": "gc_details",
      "Title": "Toggle gc_details",
      "Doc": "gc_details controls calculation of gc annotations.\n"

Initialization still lists gc_details, so gc_details command is registered to vscode.

[Trace - 19:16:24.915 PM] Received response 'initialize - (0)' in 1ms.
Result: {

CodeLens uses gopls_gc_details

[Trace - 19:12:38.210 PM] Received response 'textDocument/codeLens - (21)' in 0ms.
Result: [{"range":{"start":{"line":0,"character":0},"end":{"line":0,"character":0}},"command":{"title":"Toggle gc annotation details","command":"gopls_gc_details","arguments":["file:///Users/hakim/hello/mypkg/mypkg.go"]}}]

Since gopls_gc_details was never registered, vscode just errors.
OTOH, vscode sends gc_details command to gopls, which results in 'no known command' error.

@gopherbot gopherbot added this to the Unreleased milestone Oct 14, 2020
@hyangah hyangah modified the milestones: Unreleased, gopls/v0.5.2 Oct 14, 2020
Copy link

@gopherbot gopherbot commented Oct 15, 2020

Change mentions this issue: internal/lsp: send "gopls_" prefixed commands in initialize

Copy link

@gopherbot gopherbot commented Oct 15, 2020

Change mentions this issue: internal/lsp/source: be consistent about command identifiers

gopherbot pushed a commit to golang/tools that referenced this issue Oct 15, 2020
The primary identifier for gopls commands was changed from Command.Name
to Command.ID(), but this change was not made in the commands passed
back to the client via ExecuteCommandOptions.

Fix this, and ensure that our regtests actually check commands against
the list of supported commands that has been sent.

For golang/go#41985

Change-Id: If566584f157e8a86d26eac6353dbfd772b298cfc
Run-TryBot: Robert Findley <>
Trust: Robert Findley <>
gopls-CI: kokoro <>
TryBot-Result: Go Bot <>
Reviewed-by: Heschi Kreinick <>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.