diff options
-rw-r--r-- | docs/user/manual.adoc | 42 |
1 files changed, 27 insertions, 15 deletions
diff --git a/docs/user/manual.adoc b/docs/user/manual.adoc index f21806f0b..40f10972f 100644 --- a/docs/user/manual.adoc +++ b/docs/user/manual.adoc | |||
@@ -46,8 +46,8 @@ You can install the latest release of the plugin from | |||
46 | https://marketplace.visualstudio.com/items?itemName=matklad.rust-analyzer[the marketplace]. | 46 | https://marketplace.visualstudio.com/items?itemName=matklad.rust-analyzer[the marketplace]. |
47 | 47 | ||
48 | Note that the plugin may cause conflicts with the | 48 | Note that the plugin may cause conflicts with the |
49 | https://marketplace.visualstudio.com/items?itemName=rust-lang.rust[official Rust plugin]. It is | 49 | https://marketplace.visualstudio.com/items?itemName=rust-lang.rust[official Rust plugin]. |
50 | recommended to disable the Rust plugin when using the rust-analyzer extension. | 50 | It is recommended to disable the Rust plugin when using the rust-analyzer extension. |
51 | 51 | ||
52 | By default, the plugin will prompt you to download the matching version of the server as well: | 52 | By default, the plugin will prompt you to download the matching version of the server as well: |
53 | 53 | ||
@@ -74,18 +74,21 @@ Note that we only support two most recent versions of VS Code. | |||
74 | 74 | ||
75 | ==== Updates | 75 | ==== Updates |
76 | 76 | ||
77 | The extension will be updated automatically as new versions become available. It will ask your permission to download the matching language server version binary if needed. | 77 | The extension will be updated automatically as new versions become available. |
78 | It will ask your permission to download the matching language server version binary if needed. | ||
78 | 79 | ||
79 | ===== Nightly | 80 | ===== Nightly |
80 | 81 | ||
81 | We ship nightly releases for VS Code. To help us out with testing the newest code and follow the bleeding edge of our `master`, please use the following config: | 82 | We ship nightly releases for VS Code. |
83 | To help us out with testing the newest code and follow the bleeding edge of our `master`, please use the following config: | ||
82 | 84 | ||
83 | [source,json] | 85 | [source,json] |
84 | ---- | 86 | ---- |
85 | { "rust-analyzer.updates.channel": "nightly" } | 87 | { "rust-analyzer.updates.channel": "nightly" } |
86 | ---- | 88 | ---- |
87 | 89 | ||
88 | You will be prompted to install the `nightly` extension version. Just click `Download now` and from that moment you will get automatic updates every 24 hours. | 90 | You will be prompted to install the `nightly` extension version. |
91 | Just click `Download now` and from that moment you will get automatic updates every 24 hours. | ||
89 | 92 | ||
90 | If you don't want to be asked for `Download now` every day when the new nightly version is released add the following to your `settings.json`: | 93 | If you don't want to be asked for `Download now` every day when the new nightly version is released add the following to your `settings.json`: |
91 | [source,json] | 94 | [source,json] |
@@ -160,7 +163,8 @@ $ chmod +x ~/.local/bin/rust-analyzer | |||
160 | 163 | ||
161 | Ensure `~/.local/bin` is listed in the `$PATH` variable. | 164 | Ensure `~/.local/bin` is listed in the `$PATH` variable. |
162 | 165 | ||
163 | Alternatively, you can install it from source using the command below. You'll need the latest stable version of the Rust toolchain. | 166 | Alternatively, you can install it from source using the command below. |
167 | You'll need the latest stable version of the Rust toolchain. | ||
164 | 168 | ||
165 | [source,bash] | 169 | [source,bash] |
166 | ---- | 170 | ---- |
@@ -198,7 +202,8 @@ Emacs support is maintained as part of the https://github.com/emacs-lsp/lsp-mode | |||
198 | 202 | ||
199 | === Vim/NeoVim | 203 | === Vim/NeoVim |
200 | 204 | ||
201 | Prerequisites: You have installed the <<rust-analyzer-language-server-binary,`rust-analyzer` binary>>. Not needed if the extension can install/update it on its own, coc-rust-analyzer is one example. | 205 | Prerequisites: You have installed the <<rust-analyzer-language-server-binary,`rust-analyzer` binary>>. |
206 | Not needed if the extension can install/update it on its own, coc-rust-analyzer is one example. | ||
202 | 207 | ||
203 | The are several LSP client implementations for vim or neovim: | 208 | The are several LSP client implementations for vim or neovim: |
204 | 209 | ||
@@ -270,14 +275,16 @@ Once `neovim/nvim-lspconfig` is installed, use `+lua require'nvim_lsp'.rust_anal | |||
270 | 275 | ||
271 | Prerequisites: You have installed the <<rust-analyzer-language-server-binary,`rust-analyzer` binary>>. | 276 | Prerequisites: You have installed the <<rust-analyzer-language-server-binary,`rust-analyzer` binary>>. |
272 | 277 | ||
273 | You also need the `LSP` package. To install it: | 278 | You also need the `LSP` package. |
279 | To install it: | ||
274 | 280 | ||
275 | 1. If you've never installed a Sublime Text package, install Package Control: | 281 | 1. If you've never installed a Sublime Text package, install Package Control: |
276 | * Open the command palette (Win/Linux: `ctrl+shift+p`, Mac: `cmd+shift+p`) | 282 | * Open the command palette (Win/Linux: `ctrl+shift+p`, Mac: `cmd+shift+p`) |
277 | * Type `Install Package Control`, press enter | 283 | * Type `Install Package Control`, press enter |
278 | 2. In the command palette, run `Package control: Install package`, and in the list that pops up, type `LSP` and press enter. | 284 | 2. In the command palette, run `Package control: Install package`, and in the list that pops up, type `LSP` and press enter. |
279 | 285 | ||
280 | Finally, with your Rust project open, in the command palette, run `LSP: Enable Language Server In Project` or `LSP: Enable Language Server Globally`, then select `rust-analyzer` in the list that pops up to enable the rust-analyzer LSP. The latter means that rust-analyzer is enabled by default in Rust projects. | 286 | Finally, with your Rust project open, in the command palette, run `LSP: Enable Language Server In Project` or `LSP: Enable Language Server Globally`, then select `rust-analyzer` in the list that pops up to enable the rust-analyzer LSP. |
287 | The latter means that rust-analyzer is enabled by default in Rust projects. | ||
281 | 288 | ||
282 | If it worked, you should see "rust-analyzer, Line X, Column Y" on the left side of the bottom bar, and after waiting a bit, functionality like tooltips on hovering over variables should become available. | 289 | If it worked, you should see "rust-analyzer, Line X, Column Y" on the left side of the bottom bar, and after waiting a bit, functionality like tooltips on hovering over variables should become available. |
283 | 290 | ||
@@ -285,7 +292,8 @@ If you get an error saying `No such file or directory: 'rust-analyzer'`, see the | |||
285 | 292 | ||
286 | === GNOME Builder | 293 | === GNOME Builder |
287 | 294 | ||
288 | GNOME Builder 3.37.1 and newer has native `rust-analyzer` support. If the LSP binary is not available, GNOME Builder can install it when opening a Rust file. | 295 | GNOME Builder 3.37.1 and newer has native `rust-analyzer` support. |
296 | If the LSP binary is not available, GNOME Builder can install it when opening a Rust file. | ||
289 | 297 | ||
290 | == Configuration | 298 | == Configuration |
291 | 299 | ||
@@ -413,8 +421,8 @@ include::./generated_diagnostic.adoc[] | |||
413 | 421 | ||
414 | ==== Color configurations | 422 | ==== Color configurations |
415 | 423 | ||
416 | It is possible to change the foreground/background color of inlay hints. Just add this to your | 424 | It is possible to change the foreground/background color of inlay hints. |
417 | `settings.json`: | 425 | Just add this to your `settings.json`: |
418 | 426 | ||
419 | [source,jsonc] | 427 | [source,jsonc] |
420 | ---- | 428 | ---- |
@@ -436,7 +444,8 @@ It is possible to change the foreground/background color of inlay hints. Just ad | |||
436 | 444 | ||
437 | ==== Semantic style customizations | 445 | ==== Semantic style customizations |
438 | 446 | ||
439 | You can customize the look of different semantic elements in the source code. For example, mutable bindings are underlined by default and you can override this behavior by adding the following section to your `settings.json`: | 447 | You can customize the look of different semantic elements in the source code. |
448 | For example, mutable bindings are underlined by default and you can override this behavior by adding the following section to your `settings.json`: | ||
440 | 449 | ||
441 | [source,jsonc] | 450 | [source,jsonc] |
442 | ---- | 451 | ---- |
@@ -452,7 +461,9 @@ You can customize the look of different semantic elements in the source code. Fo | |||
452 | ---- | 461 | ---- |
453 | 462 | ||
454 | ==== Special `when` clause context for keybindings. | 463 | ==== Special `when` clause context for keybindings. |
455 | You may use `inRustProject` context to configure keybindings for rust projects only. For example: | 464 | You may use `inRustProject` context to configure keybindings for rust projects only. |
465 | For example: | ||
466 | |||
456 | [source,json] | 467 | [source,json] |
457 | ---- | 468 | ---- |
458 | { | 469 | { |
@@ -491,7 +502,8 @@ Or it is possible to specify vars more granularly: | |||
491 | ] | 502 | ] |
492 | ``` | 503 | ``` |
493 | 504 | ||
494 | You can use any valid RegExp as a mask. Also note that a full runnable name is something like *run bin_or_example_name*, *test some::mod::test_name* or *test-mod some::mod*, so it is possible to distinguish binaries, single tests, and test modules with this masks: `"^run"`, `"^test "` (the trailing space matters!), and `"^test-mod"` respectively. | 505 | You can use any valid regular expression as a mask. |
506 | Also note that a full runnable name is something like *run bin_or_example_name*, *test some::mod::test_name* or *test-mod some::mod*, so it is possible to distinguish binaries, single tests, and test modules with this masks: `"^run"`, `"^test "` (the trailing space matters!), and `"^test-mod"` respectively. | ||
495 | 507 | ||
496 | ==== Compiler feedback from external commands | 508 | ==== Compiler feedback from external commands |
497 | 509 | ||