Description
Another general protocol extension poached from rust-analyzer
CodeAction
Groups
Client Capability: { "codeActionGroup": boolean }
If this capability is set, CodeAction
returned from the server contain an additional field, group
:
interface CodeAction {
title: string;
group?: string;
...
}
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 as
💡
+-------------+
| foo |
+-------------+-----+
| frobnicate >| bar |
+-------------+-----+
| baz |
+-----+
Alternatively, selecting frobnicate
could present a user with an additional menu to choose between bar
and baz
.
Example
fn main() {
let x: Entry/*cursor here*/ = todo!();
}
Invoking code action at this position will yield two code actions for importing Entry
from either collections::HashMap
or collection::BTreeMap
, grouped under a single "import" group.
Unresolved Questions
- Is a fixed two-level structure enough?
- Should we devise a general way to encode custom interaction protocols for GUI refactorings?
IntelliJ variation: