-
Notifications
You must be signed in to change notification settings - Fork 834
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
Code Action Groups #994
Comments
What's the motivation for this over just having |
Just having two options wouldn't be too bad, and that's what clients not supporting groups get! However, grouping has two benefits:
|
I almost feel like this could be solved using some clever display logic around the hierarchical nature of |
@kjeremy good point. VS Code for example allows triggering Source and Refactor actions via a separate menu action. However making this explicit most of the time results in better UI in the longer term. |
Would the second level be resolved only once the user accesses it? |
I propose adding the ability for servers to:
Then a code action command would trigger the server ask the user for an option. |
by the way, here is how API looks like in VS - https://learn.microsoft.com/en-us/dotnet/api/microsoft.visualstudio.language.intellisense.isuggestedaction?view=visualstudiosdk-2022 basically, each code action can be invoked (executed) or/and can return nested actions. |
Another general protocol extension poached from rust-analyzer
CodeAction
GroupsClient Capability:
{ "codeActionGroup": boolean }
If this capability is set,
CodeAction
returned from the server contain an additional field,group
:All code-actions with the same
group
should be grouped under single (extendable) entry in lightbulb menu.The set of actions
[ { title: "foo" }, { group: "frobnicate", title: "bar" }, { group: "frobnicate", title: "baz" }]
should be rendered asAlternatively, selecting
frobnicate
could present a user with an additional menu to choose betweenbar
andbaz
.Example
Invoking code action at this position will yield two code actions for importing
Entry
from eithercollections::HashMap
orcollection::BTreeMap
, grouped under a single "import" group.Unresolved Questions
IntelliJ variation:
The text was updated successfully, but these errors were encountered: