diff options
Diffstat (limited to 'docs/dev/lsp-extensions.md')
-rw-r--r-- | docs/dev/lsp-extensions.md | 35 |
1 files changed, 27 insertions, 8 deletions
diff --git a/docs/dev/lsp-extensions.md b/docs/dev/lsp-extensions.md index a0847dad3..1be01fd88 100644 --- a/docs/dev/lsp-extensions.md +++ b/docs/dev/lsp-extensions.md | |||
@@ -11,11 +11,13 @@ If you want to be notified about the changes to this document, subscribe to [#46 | |||
11 | 11 | ||
12 | ## `initializationOptions` | 12 | ## `initializationOptions` |
13 | 13 | ||
14 | As `initializationOptions`, `rust-analyzer` expects `"rust-analyzer"` section of the configuration. | 14 | For `initializationOptions`, `rust-analyzer` expects `"rust-analyzer"` section of the configuration. |
15 | That is, `rust-analyzer` usually sends `"workspace/configuration"` request with `{ "items": ["rust-analyzer"] }` payload. | 15 | That is, `rust-analyzer` usually sends `"workspace/configuration"` request with `{ "items": ["rust-analyzer"] }` payload. |
16 | `initializationOptions` should contain the same data that would be in the first item of the result. | 16 | `initializationOptions` should contain the same data that would be in the first item of the result. |
17 | It's OK to not send anything, then all the settings would take their default values. | 17 | If a language client does not know about `rust-analyzer`'s configuration options it can get sensible defaults by doing any of the following: |
18 | However, some settings can not be changed after startup at the moment. | 18 | * Not sending `initializationOptions` |
19 | * Send `"initializationOptions": null` | ||
20 | * Send `"initializationOptions": {}` | ||
19 | 21 | ||
20 | ## Snippet `TextEdit` | 22 | ## Snippet `TextEdit` |
21 | 23 | ||
@@ -272,6 +274,11 @@ interface SsrParams { | |||
272 | query: string, | 274 | query: string, |
273 | /// If true, only check the syntax of the query and don't compute the actual edit. | 275 | /// If true, only check the syntax of the query and don't compute the actual edit. |
274 | parseOnly: bool, | 276 | parseOnly: bool, |
277 | /// The current text document. This and `position` will be used to determine in what scope | ||
278 | /// paths in `query` should be resolved. | ||
279 | textDocument: lc.TextDocumentIdentifier; | ||
280 | /// Position where SSR was invoked. | ||
281 | position: lc.Position; | ||
275 | } | 282 | } |
276 | ``` | 283 | ``` |
277 | 284 | ||
@@ -283,7 +290,7 @@ WorkspaceEdit | |||
283 | 290 | ||
284 | ### Example | 291 | ### Example |
285 | 292 | ||
286 | SSR with query `foo($a:expr, $b:expr) ==>> ($a).foo($b)` will transform, eg `foo(y + 5, z)` into `(y + 5).foo(z)`. | 293 | SSR with query `foo($a, $b) ==>> ($a).foo($b)` will transform, eg `foo(y + 5, z)` into `(y + 5).foo(z)`. |
287 | 294 | ||
288 | ### Unresolved Question | 295 | ### Unresolved Question |
289 | 296 | ||
@@ -389,15 +396,27 @@ rust-analyzer supports only one `kind`, `"cargo"`. The `args` for `"cargo"` look | |||
389 | 396 | ||
390 | Returns internal status message, mostly for debugging purposes. | 397 | Returns internal status message, mostly for debugging purposes. |
391 | 398 | ||
392 | ## Collect Garbage | 399 | ## Reload Workspace |
393 | 400 | ||
394 | **Method:** `rust-analyzer/collectGarbage` | 401 | **Method:** `rust-analyzer/reloadWorkspace` |
395 | 402 | ||
396 | **Request:** `null` | 403 | **Request:** `null` |
397 | 404 | ||
398 | **Response:** `null` | 405 | **Response:** `null` |
399 | 406 | ||
400 | Frees some caches. For internal use, and is mostly broken at the moment. | 407 | Reloads project information (that is, re-executes `cargo metadata`). |
408 | |||
409 | ## Status Notification | ||
410 | |||
411 | **Client Capability:** `{ "statusNotification": boolean }` | ||
412 | |||
413 | **Method:** `rust-analyzer/status` | ||
414 | |||
415 | **Notification:** `"loading" | "ready" | "invalid" | "needsReload"` | ||
416 | |||
417 | This notification is sent from server to client. | ||
418 | The client can use it to display persistent status to the user (in modline). | ||
419 | For `needsReload` state, the client can provide a context-menu action to run `rust-analyzer/reloadWorkspace` request. | ||
401 | 420 | ||
402 | ## Syntax Tree | 421 | ## Syntax Tree |
403 | 422 | ||
@@ -504,4 +523,4 @@ Such actions on the client side are appended to a hover bottom as command links: | |||
504 | | TITLE _Action1_ | _Action2_ | <- second group | 523 | | TITLE _Action1_ | _Action2_ | <- second group |
505 | +-----------------------------+ | 524 | +-----------------------------+ |
506 | ... | 525 | ... |
507 | ``` \ No newline at end of file | 526 | ``` |