Skip to content

Commit a9a978e

Browse files
bors[bot]matklad
andauthored
Merge #9021
9021: internal: explain the motivation behind early configuration r=matklad a=matklad bors r+ 🤖 Co-authored-by: Aleksey Kladov <[email protected]>
2 parents 7d1653d + cabb679 commit a9a978e

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

docs/dev/lsp-extensions.md

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,21 @@ rust-analyzer supports clangd's extension for opting into UTF-8 as the coordinat
2525

2626
https://clangd.llvm.org/extensions.html#utf-8-offsets
2727

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.
2938

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.
3339
If a language client does not know about `rust-analyzer`'s configuration options it can get sensible defaults by doing any of the following:
3440
* Not sending `initializationOptions`
35-
* Send `"initializationOptions": null`
36-
* Send `"initializationOptions": {}`
41+
* Sending `"initializationOptions": null`
42+
* Sending `"initializationOptions": {}`
3743

3844
## Snippet `TextEdit`
3945

0 commit comments

Comments
 (0)