aboutsummaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
Diffstat (limited to 'docs')
-rw-r--r--docs/dev/architecture.md8
-rw-r--r--docs/dev/lsp-extensions.md18
-rw-r--r--docs/user/generated_config.adoc25
-rw-r--r--docs/user/manual.adoc10
4 files changed, 44 insertions, 17 deletions
diff --git a/docs/dev/architecture.md b/docs/dev/architecture.md
index 39edf9e19..3de1b99a5 100644
--- a/docs/dev/architecture.md
+++ b/docs/dev/architecture.md
@@ -146,6 +146,8 @@ Reading the docs of the `base_db::input` module should be useful: everything els
146 146
147**Architecture Invariant:** particularities of the build system are *not* the part of the ground state. 147**Architecture Invariant:** particularities of the build system are *not* the part of the ground state.
148In particular, `base_db` knows nothing about cargo. 148In particular, `base_db` knows nothing about cargo.
149For example, `cfg` flags are a part of `base_db`, but `feature`s are not.
150A `foo` feature is a Cargo-level concept, which is lowered by Cargo to `--cfg feature=foo` argument on the command line.
149The `CrateGraph` structure is used to represent the dependencies between the crates abstractly. 151The `CrateGraph` structure is used to represent the dependencies between the crates abstractly.
150 152
151**Architecture Invariant:** `base_db` doesn't know about file system and file paths. 153**Architecture Invariant:** `base_db` doesn't know about file system and file paths.
@@ -447,3 +449,9 @@ This is cheap enough to enable in production.
447 449
448Similarly, we save live object counting (`RA_COUNT=1`). 450Similarly, we save live object counting (`RA_COUNT=1`).
449It is not cheap enough to enable in prod, and this is a bug which should be fixed. 451It is not cheap enough to enable in prod, and this is a bug which should be fixed.
452
453### Configurability
454
455rust-analyzer strives to be as configurable as possible while offering reasonable defaults where no configuration exists yet.
456There will always be features that some people find more annoying than helpful, so giving the users the ability to tweak or disable these is a big part of offering a good user experience.
457Mind the code--architecture gap: at the moment, we are using fewer feature flags than we really should.
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
26https://clangd.llvm.org/extensions.html#utf-8-offsets 26https://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
32The `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.
35However, the server can't do this during initialization.
36At the same time some essential configuration parameters are needed early on, before servicing requests.
37For this reason, we ask that `initializationOptions` contains the configuration, as if the server did make a `"workspace/configuration"` request.
29 38
30For `initializationOptions`, `rust-analyzer` expects `"rust-analyzer"` section of the configuration.
31That 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.
33If a language client does not know about `rust-analyzer`'s configuration options it can get sensible defaults by doing any of the following: 39If 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
diff --git a/docs/user/generated_config.adoc b/docs/user/generated_config.adoc
index c02bab7cc..dbd9a3503 100644
--- a/docs/user/generated_config.adoc
+++ b/docs/user/generated_config.adoc
@@ -136,6 +136,12 @@ Whether to show postfix snippets like `dbg`, `if`, `not`, etc.
136Toggles the additional completions that automatically add imports when completed. 136Toggles the additional completions that automatically add imports when completed.
137Note that your client must specify the `additionalTextEdits` LSP client capability to truly have this feature enabled. 137Note that your client must specify the `additionalTextEdits` LSP client capability to truly have this feature enabled.
138-- 138--
139[[rust-analyzer.completion.autoself.enable]]rust-analyzer.completion.autoself.enable (default: `true`)::
140+
141--
142Toggles the additional completions that automatically show method calls and field accesses
143with `self` prefixed to them when inside a method.
144--
139[[rust-analyzer.diagnostics.enable]]rust-analyzer.diagnostics.enable (default: `true`):: 145[[rust-analyzer.diagnostics.enable]]rust-analyzer.diagnostics.enable (default: `true`)::
140+ 146+
141-- 147--
@@ -161,18 +167,18 @@ This should be the reverse mapping of what is passed to `rustc` as `--remap-path
161[[rust-analyzer.diagnostics.warningsAsHint]]rust-analyzer.diagnostics.warningsAsHint (default: `[]`):: 167[[rust-analyzer.diagnostics.warningsAsHint]]rust-analyzer.diagnostics.warningsAsHint (default: `[]`)::
162+ 168+
163-- 169--
164List of warnings that should be displayed with info severity. 170List of warnings that should be displayed with hint severity.
165 171
166The warnings will be indicated by a blue squiggly underline in code 172The warnings will be indicated by faded text or three dots in code
167and a blue icon in the `Problems Panel`. 173and will not show up in the `Problems Panel`.
168-- 174--
169[[rust-analyzer.diagnostics.warningsAsInfo]]rust-analyzer.diagnostics.warningsAsInfo (default: `[]`):: 175[[rust-analyzer.diagnostics.warningsAsInfo]]rust-analyzer.diagnostics.warningsAsInfo (default: `[]`)::
170+ 176+
171-- 177--
172List of warnings that should be displayed with hint severity. 178List of warnings that should be displayed with info severity.
173 179
174The warnings will be indicated by faded text or three dots in code 180The warnings will be indicated by a blue squiggly underline in code
175and will not show up in the `Problems Panel`. 181and a blue icon in the `Problems Panel`.
176-- 182--
177[[rust-analyzer.files.watcher]]rust-analyzer.files.watcher (default: `"client"`):: 183[[rust-analyzer.files.watcher]]rust-analyzer.files.watcher (default: `"client"`)::
178+ 184+
@@ -346,6 +352,13 @@ Additional arguments to `rustfmt`.
346Advanced option, fully override the command rust-analyzer uses for 352Advanced option, fully override the command rust-analyzer uses for
347formatting. 353formatting.
348-- 354--
355[[rust-analyzer.rustfmt.enableRangeFormatting]]rust-analyzer.rustfmt.enableRangeFormatting (default: `false`)::
356+
357--
358Enables the use of rustfmt's unstable range formatting command for the
359`textDocument/rangeFormatting` request. The rustfmt option is unstable and only
360available on a nightly build.
361--
349[[rust-analyzer.workspace.symbol.search.scope]]rust-analyzer.workspace.symbol.search.scope (default: `"workspace"`):: 362[[rust-analyzer.workspace.symbol.search.scope]]rust-analyzer.workspace.symbol.search.scope (default: `"workspace"`)::
350+ 363+
351-- 364--
diff --git a/docs/user/manual.adoc b/docs/user/manual.adoc
index ad367511b..1f95df56e 100644
--- a/docs/user/manual.adoc
+++ b/docs/user/manual.adoc
@@ -139,18 +139,18 @@ $ cargo xtask install --server
139=== rust-analyzer Language Server Binary 139=== rust-analyzer Language Server Binary
140 140
141Other editors generally require the `rust-analyzer` binary to be in `$PATH`. 141Other editors generally require the `rust-analyzer` binary to be in `$PATH`.
142You can download the pre-built binary from the https://github.com/rust-analyzer/rust-analyzer/releases[releases] page. 142You can download pre-built binaries from the https://github.com/rust-analyzer/rust-analyzer/releases[releases] page.
143Typically, you then need to rename the binary for your platform, e.g. `rust-analyzer-mac` if you're on Mac OS, to `rust-analyzer` and make it executable in addition to moving it into a directory in your `$PATH`. 143You will need to uncompress and rename the binary for your platform, e.g. from `rust-analyzer-aarch64-apple-darwin.gz` on Mac OS to `rust-analyzer`, make it executable, then move it into a directory in your `$PATH`.
144 144
145On Linux to install the `rust-analyzer` binary into `~/.local/bin`, this commands could be used 145On Linux to install the `rust-analyzer` binary into `~/.local/bin`, these commands should work:
146 146
147[source,bash] 147[source,bash]
148---- 148----
149$ curl -L https://github.com/rust-analyzer/rust-analyzer/releases/latest/download/rust-analyzer-linux -o ~/.local/bin/rust-analyzer 149$ curl -L https://github.com/rust-analyzer/rust-analyzer/releases/latest/download/rust-analyzer-x86_64-unknown-linux-gnu.gz | gunzip -c - > ~/.local/bin/rust-analyzer
150$ chmod +x ~/.local/bin/rust-analyzer 150$ chmod +x ~/.local/bin/rust-analyzer
151---- 151----
152 152
153Ensure `~/.local/bin` is listed in the `$PATH` variable. 153Make sure that `~/.local/bin` is listed in the `$PATH` variable and use the appropriate URL if you're not on a `x86-64` system.
154 154
155Alternatively, you can install it from source using the command below. 155Alternatively, you can install it from source using the command below.
156You'll need the latest stable version of the Rust toolchain. 156You'll need the latest stable version of the Rust toolchain.