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: include gopls' CodeAction kinds in the documentation, plus the default set #68791

Open
adonovan opened this issue Aug 8, 2024 · 1 comment
Assignees
Labels
Documentation 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

@adonovan
Copy link
Member

adonovan commented Aug 8, 2024

The code action kind values (e.g. "source.doc") form part of the LSP interface to gopls. They should be mentioned in the documentation of the web-based features and transformations. Also, the docs should provide the default list, similar to how it they do for code lenses.

For context, see:

@adonovan adonovan self-assigned this Aug 8, 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 Aug 8, 2024
@gopherbot gopherbot added this to the Unreleased milestone Aug 8, 2024
@findleyr findleyr modified the milestones: Unreleased, gopls/v0.17.0 Aug 12, 2024
@gopherbot
Copy link
Contributor

Change https://go.dev/cl/604818 mentions this issue: gopls/internal/settings: use CodeActionKind hierarchy

gopherbot pushed a commit to golang/tools that referenced this issue Sep 12, 2024
This change causes all CodeActions returned by gopls to use a
specific leaf type such as refactor.inline.call, instead of a
general category such as refactor or refactor.inline. The
categories may continue to be specified in the "Only" parameter
of a CodeActions request, and they apply hierarchically.
This allows clients to be more specific in requesting a
particular Code Action.

Details of golang/codeaction.go (messy diff):
- don't separate "typed" from "syntax only" operations;
  in practice we always need types.
- enabled (func) replaces want (map). It is computed
  in server.CodeAction and plumbed down.
- the "add" helper wraps a Command in a CodeAction
  and adds it to the result.

Also:
- use camelCase names, following LSP's source.organizeImports.
- document the specific kinds in the user manual
  and add a release note.
- remove the CodeAction title regexp parameter from
  @codeaction{,err} marker tests since the kind is
  now sufficiently expressive.

Fixes golang/go#40438
Updates golang/go#68791
Updates golang/go#68783

Change-Id: I1898f79d8af441a0376ad5067d05e0621840d987
Reviewed-on: https://go-review.googlesource.com/c/tools/+/604818
Reviewed-by: Robert Findley <rfindley@google.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation 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