diff options
Diffstat (limited to 'docs')
-rw-r--r-- | docs/dev/lsp-extensions.md | 109 |
1 files changed, 108 insertions, 1 deletions
diff --git a/docs/dev/lsp-extensions.md b/docs/dev/lsp-extensions.md index 1cc51410b..55035cfae 100644 --- a/docs/dev/lsp-extensions.md +++ b/docs/dev/lsp-extensions.md | |||
@@ -95,7 +95,7 @@ Invoking code action at this position will yield two code actions for importing | |||
95 | 95 | ||
96 | This request is send from client to server to handle "Join Lines" editor action. | 96 | This request is send from client to server to handle "Join Lines" editor action. |
97 | 97 | ||
98 | **Method:** `experimental/JoinLines` | 98 | **Method:** `experimental/joinLines` |
99 | 99 | ||
100 | **Request:** | 100 | **Request:** |
101 | 101 | ||
@@ -172,3 +172,110 @@ SSR with query `foo($a:expr, $b:expr) ==>> ($a).foo($b)` will transform, eg `foo | |||
172 | 172 | ||
173 | * Probably needs search without replace mode | 173 | * Probably needs search without replace mode |
174 | * Needs a way to limit the scope to certain files. | 174 | * Needs a way to limit the scope to certain files. |
175 | |||
176 | ## Matching Brace | ||
177 | |||
178 | **Issue:** https://github.com/microsoft/language-server-protocol/issues/999 | ||
179 | |||
180 | **Server Capability:** `{ "matchingBrace": boolean }` | ||
181 | |||
182 | This request is send from client to server to handle "Matching Brace" editor action. | ||
183 | |||
184 | **Method:** `experimental/matchingBrace` | ||
185 | |||
186 | **Request:** | ||
187 | |||
188 | ```typescript | ||
189 | interface MatchingBraceParams { | ||
190 | textDocument: TextDocumentIdentifier, | ||
191 | /// Position for each cursor | ||
192 | positions: Position[], | ||
193 | } | ||
194 | ``` | ||
195 | |||
196 | **Response:** | ||
197 | |||
198 | ```typescript | ||
199 | Position[] | ||
200 | ``` | ||
201 | |||
202 | ### Example | ||
203 | |||
204 | ```rust | ||
205 | fn main() { | ||
206 | let x: Vec<()>/*cursor here*/ = vec![] | ||
207 | } | ||
208 | ``` | ||
209 | |||
210 | `experimental/matchingBrace` yields the position of `<`. | ||
211 | In many cases, matching braces can be handled by the editor. | ||
212 | However, some cases (like disambiguating between generics and comparison operations) need a real parser. | ||
213 | Moreover, it would be cool if editors didn't need to implement even basic language parsing | ||
214 | |||
215 | ### Unresolved Question | ||
216 | |||
217 | * Should we return a a nested brace structure, to allow paredit-like actions of jump *out* of the current brace pair? | ||
218 | This is how `SelectionRange` request works. | ||
219 | * Alternatively, should we perhaps flag certain `SelectionRange`s as being brace pairs? | ||
220 | |||
221 | ## Analyzer Status | ||
222 | |||
223 | **Method:** `rust-analyzer/analyzerStatus` | ||
224 | |||
225 | **Request:** `null` | ||
226 | |||
227 | **Response:** `string` | ||
228 | |||
229 | Returns internal status message, mostly for debugging purposes. | ||
230 | |||
231 | ## Collect Garbage | ||
232 | |||
233 | **Method:** `rust-analyzer/collectGarbage` | ||
234 | |||
235 | **Request:** `null` | ||
236 | |||
237 | **Response:** `null` | ||
238 | |||
239 | Frees some caches. For internal use, and is mostly broken at the moment. | ||
240 | |||
241 | ## Syntax Tree | ||
242 | |||
243 | **Method:** `rust-analyzer/syntaxTree` | ||
244 | |||
245 | **Request:** | ||
246 | |||
247 | ```typescript | ||
248 | interface SyntaxTeeParams { | ||
249 | textDocument: TextDocumentIdentifier, | ||
250 | range?: Range, | ||
251 | } | ||
252 | ``` | ||
253 | |||
254 | **Response:** `string` | ||
255 | |||
256 | Returns textual representation of a parse tree for the file/selected region. | ||
257 | Primarily for debugging, but very useful for all people working on rust-analyzer itself. | ||
258 | |||
259 | ## Expand Macro | ||
260 | |||
261 | **Method:** `rust-analyzer/expandMacro` | ||
262 | |||
263 | **Request:** | ||
264 | |||
265 | ```typescript | ||
266 | interface ExpandMacroParams { | ||
267 | textDocument: TextDocumentIdentifier, | ||
268 | position?: Position, | ||
269 | } | ||
270 | ``` | ||
271 | |||
272 | **Response:** | ||
273 | |||
274 | ```typescript | ||
275 | interface ExpandedMacro { | ||
276 | name: string, | ||
277 | expansion: string, | ||
278 | } | ||
279 | ``` | ||
280 | |||
281 | Expands macro call at a given position. | ||