Skip to content

x/tools/gopls: organizeImports code action is broken #67824

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

Closed
hyangah opened this issue Jun 4, 2024 · 1 comment
Closed

x/tools/gopls: organizeImports code action is broken #67824

hyangah opened this issue Jun 4, 2024 · 1 comment
Assignees
Labels
gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@hyangah
Copy link
Contributor

hyangah commented Jun 4, 2024

OrganizeImports code action is broken after CL 587555 (golang/tools@e1b14a1915)

Gopls built after the change returns no edit.

[Trace - 16:20:53.314 PM] Sending request 'textDocument/codeAction - (26)'.
Params: {"textDocument":{"uri":"file:///Users/hakim/projects/vscode-go/extension/tools/xinstall/main.go"},"range":{"start":{"line":0,"character":0},"end":{"line":24,"character":0}},"context":{"diagnostics":[{"range":{"start":{"line":19,"character":21},"end":{"line":19,"character":28}},"message":"undefined: runtime","code":"UndeclaredName","codeDescription":{"href":"https://pkg.go.dev/golang.org/x/tools/internal/typesinternal#UndeclaredName"},"severity":1,"source":"compiler"},{"range":{"start":{"line":19,"character":35},"end":{"line":19,"character":42}},"message":"undefined: runtime","code":"UndeclaredName","codeDescription":{"href":"https://pkg.go.dev/golang.org/x/tools/internal/typesinternal#UndeclaredName"},"severity":1,"source":"compiler"}],"only":["source.organizeImports"],"triggerKind":2}}


[Trace - 16:20:53.314 PM] Received response 'textDocument/codeAction - (26)' in 0ms.
Result: null

Gopls v0.15.3 returns the following response.

[Trace - 16:27:20.053 PM] Received response 'textDocument/codeAction - (53)' in 1ms.
Result: [{"title":"Organize Imports","kind":"source.organizeImports","edit":{"documentChanges":[{"textDocument":{"version":7,"uri":"file:///Users/hakim/projects/vscode-go/extension/tools/xinstall/main.go"},"edits":[{"range":{"start":{"line":10,"character":4},"end":{"line":10,"character":4}},"newText":"\"\n\t\"runtime"}]}]}}]
@hyangah hyangah added this to the gopls/v0.16.0 milestone Jun 4, 2024
@gopherbot gopherbot added Tools This label describes issues relating to any tools in the x/tools repository. gopls Issues related to the Go language server, gopls. labels Jun 4, 2024
@hyangah
Copy link
Contributor Author

hyangah commented Jun 4, 2024

Duplicate of #67823 :-)

@hyangah hyangah closed this as not planned Won't fix, can't repro, duplicate, stale Jun 4, 2024
@hyangah hyangah modified the milestones: gopls/v0.16.0, Unplanned Jun 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

3 participants