diff options
author | Ilya Bobyr <[email protected]> | 2021-02-04 02:33:19 +0000 |
---|---|---|
committer | Ilya Bobyr <[email protected]> | 2021-02-08 04:24:56 +0000 |
commit | 6781692732d04968fe8ce09ded59f2faae492d82 (patch) | |
tree | a7a4b0724e29cf299757378c2f00662506d834e0 | |
parent | 336909b63a14b801520c6627d90d750babcfe280 (diff) |
Explain how initial configuration is sent over LSP.
-rw-r--r-- | docs/user/manual.adoc | 32 |
1 files changed, 27 insertions, 5 deletions
diff --git a/docs/user/manual.adoc b/docs/user/manual.adoc index 10d4fd606..93bf6d678 100644 --- a/docs/user/manual.adoc +++ b/docs/user/manual.adoc | |||
@@ -335,13 +335,35 @@ If the LSP binary is not available, GNOME Builder can install it when opening a | |||
335 | 335 | ||
336 | **Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/rust-analyzer/src/config.rs[config.rs] | 336 | **Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/rust-analyzer/src/config.rs[config.rs] |
337 | 337 | ||
338 | rust-analyzer is configured via LSP messages, which means that it's up to the editor to decide on the exact format and location of configuration files. | 338 | The <<_installation,Installation>> section contains details on configuration for some of the editors. |
339 | Please consult your editor's documentation to learn how to configure LSP servers. | 339 | In general `rust-analyzer` is configured via LSP messages, which means that it's up to the editor to decide on the exact format and location of configuration files. |
340 | 340 | ||
341 | To verify which configuration is actually used by rust-analyzer, set `RA_LOG` environment variable to `rust_analyzer=info` and look for config-related messages. | 341 | Some clients, such as <<vs-code,VS Code>> or <<coc-rust-analyzer,COC plugin in Vim>> provide `rust-analyzer` specific configuration UIs. Others may require you to know a bit more about the interaction with `rust-analyzer`. |
342 | Logs should show both the JSON that rust-analyzer sees as well as the updated config. | ||
343 | 342 | ||
344 | This is the list of config options rust-analyzer supports: | 343 | For the later category, it might help to know that the initial configuration is specified as a value of the `intializationOptions` field of the https://microsoft.github.io/language-server-protocol/specifications/specification-current/#initialize[`InitializeParams` message, in the LSP protocol]. |
344 | The spec says that the field type is `any?`, but `rust-analyzer` is looking for a JSON object that is constructed using settings from the list below. | ||
345 | Name of the setting, ignoring the `rust-analyzer.` prefix, is used as a path, and value of the setting becomes the JSON property value. | ||
346 | |||
347 | For example, a very common configuration is to enable proc-macro support, can be achieved by sending this JSON: | ||
348 | |||
349 | [source,json] | ||
350 | ---- | ||
351 | { | ||
352 | "cargo": { | ||
353 | "loadOutDirsFromCheck": true, | ||
354 | }, | ||
355 | "procMacro": { | ||
356 | "enable": true, | ||
357 | } | ||
358 | } | ||
359 | ---- | ||
360 | |||
361 | Please consult your editor's documentation to learn more about how to configure https://microsoft.github.io/language-server-protocol/[LSP servers]. | ||
362 | |||
363 | To verify which configuration is actually used by `rust-analyzer`, set `RA_LOG` environment variable to `rust_analyzer=info` and look for config-related messages. | ||
364 | Logs should show both the JSON that `rust-analyzer` sees as well as the updated config. | ||
365 | |||
366 | This is the list of config options `rust-analyzer` supports: | ||
345 | 367 | ||
346 | include::./generated_config.adoc[] | 368 | include::./generated_config.adoc[] |
347 | 369 | ||