diff options
Diffstat (limited to 'docs/dev/lsp-extensions.md')
-rw-r--r-- | docs/dev/lsp-extensions.md | 55 |
1 files changed, 53 insertions, 2 deletions
diff --git a/docs/dev/lsp-extensions.md b/docs/dev/lsp-extensions.md index 7c45aef4c..158d3c599 100644 --- a/docs/dev/lsp-extensions.md +++ b/docs/dev/lsp-extensions.md | |||
@@ -5,7 +5,9 @@ It's a best effort document, when in doubt, consult the source (and send a PR wi | |||
5 | We aim to upstream all non Rust-specific extensions to the protocol, but this is not a top priority. | 5 | We aim to upstream all non Rust-specific extensions to the protocol, but this is not a top priority. |
6 | All capabilities are enabled via `experimental` field of `ClientCapabilities`. | 6 | All capabilities are enabled via `experimental` field of `ClientCapabilities`. |
7 | 7 | ||
8 | ## `SnippetTextEdit` | 8 | ## Snippet `TextEdit` |
9 | |||
10 | **Issue:** https://github.com/microsoft/language-server-protocol/issues/724 | ||
9 | 11 | ||
10 | **Client Capability:** `{ "snippetTextEdit": boolean }` | 12 | **Client Capability:** `{ "snippetTextEdit": boolean }` |
11 | 13 | ||
@@ -36,7 +38,9 @@ At the moment, rust-analyzer guarantees that only a single edit will have `Inser | |||
36 | * Where exactly are `SnippetTextEdit`s allowed (only in code actions at the moment)? | 38 | * Where exactly are `SnippetTextEdit`s allowed (only in code actions at the moment)? |
37 | * Can snippets span multiple files (so far, no)? | 39 | * Can snippets span multiple files (so far, no)? |
38 | 40 | ||
39 | ## `joinLines` | 41 | ## Join Lines |
42 | |||
43 | **Issue:** https://github.com/microsoft/language-server-protocol/issues/992 | ||
40 | 44 | ||
41 | **Server Capability:** `{ "joinLines": boolean }` | 45 | **Server Capability:** `{ "joinLines": boolean }` |
42 | 46 | ||
@@ -119,3 +123,50 @@ SSR with query `foo($a:expr, $b:expr) ==>> ($a).foo($b)` will transform, eg `foo | |||
119 | 123 | ||
120 | * Probably needs search without replace mode | 124 | * Probably needs search without replace mode |
121 | * Needs a way to limit the scope to certain files. | 125 | * Needs a way to limit the scope to certain files. |
126 | |||
127 | ## `CodeAction` Groups | ||
128 | |||
129 | **Issue:** https://github.com/microsoft/language-server-protocol/issues/994 | ||
130 | |||
131 | **Client Capability:** `{ "codeActionGroup": boolean }` | ||
132 | |||
133 | If this capability is set, `CodeAction` returned from the server contain an additional field, `group`: | ||
134 | |||
135 | ```typescript | ||
136 | interface CodeAction { | ||
137 | title: string; | ||
138 | group?: string; | ||
139 | ... | ||
140 | } | ||
141 | ``` | ||
142 | |||
143 | All code-actions with the same `group` should be grouped under single (extendable) entry in lightbulb menu. | ||
144 | The set of actions `[ { title: "foo" }, { group: "frobnicate", title: "bar" }, { group: "frobnicate", title: "baz" }]` should be rendered as | ||
145 | |||
146 | ``` | ||
147 | 💡 | ||
148 | +-------------+ | ||
149 | | foo | | ||
150 | +-------------+-----+ | ||
151 | | frobnicate >| bar | | ||
152 | +-------------+-----+ | ||
153 | | baz | | ||
154 | +-----+ | ||
155 | ``` | ||
156 | |||
157 | Alternatively, selecting `frobnicate` could present a user with an additional menu to choose between `bar` and `baz`. | ||
158 | |||
159 | ### Example | ||
160 | |||
161 | ```rust | ||
162 | fn main() { | ||
163 | let x: Entry/*cursor here*/ = todo!(); | ||
164 | } | ||
165 | ``` | ||
166 | |||
167 | 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. | ||
168 | |||
169 | ### Unresolved Questions | ||
170 | |||
171 | * Is a fixed two-level structure enough? | ||
172 | * Should we devise a general way to encode custom interaction protocols for GUI refactorings? | ||