diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-05-27 09:17:10 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2021-05-27 09:17:10 +0100 |
commit | a9a978e0bb418b540bd4ede0cc5a16bfb1c79baf (patch) | |
tree | 5b0a12bb421cffa9e4b7ee0d966b9df2d1bd93bb /docs | |
parent | 7d1653dcdc94347cccaf8d50d45d896a3c286d93 (diff) | |
parent | cabb679cbb7d94fba5bdbcfdb0dc66e9fdd47415 (diff) |
Merge #9021
9021: internal: explain the motivation behind early configuration r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'docs')
-rw-r--r-- | docs/dev/lsp-extensions.md | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/docs/dev/lsp-extensions.md b/docs/dev/lsp-extensions.md index fbe2ce1c9..11a3dd04e 100644 --- a/docs/dev/lsp-extensions.md +++ b/docs/dev/lsp-extensions.md | |||
@@ -25,15 +25,21 @@ rust-analyzer supports clangd's extension for opting into UTF-8 as the coordinat | |||
25 | 25 | ||
26 | https://clangd.llvm.org/extensions.html#utf-8-offsets | 26 | https://clangd.llvm.org/extensions.html#utf-8-offsets |
27 | 27 | ||
28 | ## `initializationOptions` | 28 | ## Configuration in `initializationOptions` |
29 | |||
30 | **Issue:** https://github.com/microsoft/language-server-protocol/issues/567 | ||
31 | |||
32 | The `initializationOptions` filed of the `InitializeParams` of the initialization request should contain `"rust-analyzer"` section of the configuration. | ||
33 | |||
34 | `rust-analyzer` normally sends a `"workspace/configuration"` request with `{ "items": ["rust-analyzer"] }` payload. | ||
35 | However, the server can't do this during initialization. | ||
36 | At the same time some essential configuration parameters are needed early on, before servicing requests. | ||
37 | For this reason, we ask that `initializationOptions` contains the configuration, as if the server did make a `"workspace/configuration"` request. | ||
29 | 38 | ||
30 | For `initializationOptions`, `rust-analyzer` expects `"rust-analyzer"` section of the configuration. | ||
31 | That is, `rust-analyzer` usually sends `"workspace/configuration"` request with `{ "items": ["rust-analyzer"] }` payload. | ||
32 | `initializationOptions` should contain the same data that would be in the first item of the result. | ||
33 | If a language client does not know about `rust-analyzer`'s configuration options it can get sensible defaults by doing any of the following: | 39 | If a language client does not know about `rust-analyzer`'s configuration options it can get sensible defaults by doing any of the following: |
34 | * Not sending `initializationOptions` | 40 | * Not sending `initializationOptions` |
35 | * Send `"initializationOptions": null` | 41 | * Sending `"initializationOptions": null` |
36 | * Send `"initializationOptions": {}` | 42 | * Sending `"initializationOptions": {}` |
37 | 43 | ||
38 | ## Snippet `TextEdit` | 44 | ## Snippet `TextEdit` |
39 | 45 | ||