aboutsummaryrefslogtreecommitdiff
path: root/docs/user
diff options
context:
space:
mode:
authorIlya Bobyr <[email protected]>2021-02-04 02:33:19 +0000
committerIlya Bobyr <[email protected]>2021-02-08 04:24:56 +0000
commit6781692732d04968fe8ce09ded59f2faae492d82 (patch)
treea7a4b0724e29cf299757378c2f00662506d834e0 /docs/user
parent336909b63a14b801520c6627d90d750babcfe280 (diff)
Explain how initial configuration is sent over LSP.
Diffstat (limited to 'docs/user')
-rw-r--r--docs/user/manual.adoc32
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
338rust-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. 338The <<_installation,Installation>> section contains details on configuration for some of the editors.
339Please consult your editor's documentation to learn how to configure LSP servers. 339In 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
341To verify which configuration is actually used by rust-analyzer, set `RA_LOG` environment variable to `rust_analyzer=info` and look for config-related messages. 341Some 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`.
342Logs should show both the JSON that rust-analyzer sees as well as the updated config.
343 342
344This is the list of config options rust-analyzer supports: 343For 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].
344The 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.
345Name of the setting, ignoring the `rust-analyzer.` prefix, is used as a path, and value of the setting becomes the JSON property value.
346
347For 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
361Please consult your editor's documentation to learn more about how to configure https://microsoft.github.io/language-server-protocol/[LSP servers].
362
363To verify which configuration is actually used by `rust-analyzer`, set `RA_LOG` environment variable to `rust_analyzer=info` and look for config-related messages.
364Logs should show both the JSON that `rust-analyzer` sees as well as the updated config.
365
366This is the list of config options `rust-analyzer` supports:
345 367
346include::./generated_config.adoc[] 368include::./generated_config.adoc[]
347 369