diff options
Diffstat (limited to 'docs')
-rw-r--r-- | docs/user/manual.adoc | 56 |
1 files changed, 44 insertions, 12 deletions
diff --git a/docs/user/manual.adoc b/docs/user/manual.adoc index b763958fe..7816287e4 100644 --- a/docs/user/manual.adoc +++ b/docs/user/manual.adoc | |||
@@ -109,18 +109,6 @@ Here are some useful self-diagnostic commands: | |||
109 | * To log all LSP requests, add `"rust-analyzer.trace.server": "verbose"` to the settings and look for `Server Trace` in the panel. | 109 | * To log all LSP requests, add `"rust-analyzer.trace.server": "verbose"` to the settings and look for `Server Trace` in the panel. |
110 | * To enable client-side logging, add `"rust-analyzer.trace.extension": true` to the settings and open the `Console` tab of VS Code developer tools. | 110 | * To enable client-side logging, add `"rust-analyzer.trace.extension": true` to the settings and open the `Console` tab of VS Code developer tools. |
111 | 111 | ||
112 | ==== Special `when` clause context for keybindings. | ||
113 | You may use `inRustProject` context to configure keybindings for rust projects only. For example: | ||
114 | [source,json] | ||
115 | ---- | ||
116 | { | ||
117 | "key": "ctrl+i", | ||
118 | "command": "rust-analyzer.toggleInlayHints", | ||
119 | "when": "inRustProject" | ||
120 | } | ||
121 | ---- | ||
122 | More about `when` clause contexts https://code.visualstudio.com/docs/getstarted/keybindings#_when-clause-contexts[here]. | ||
123 | |||
124 | === rust-analyzer Language Server Binary | 112 | === rust-analyzer Language Server Binary |
125 | 113 | ||
126 | Other editors generally require the `rust-analyzer` binary to be in `$PATH`. | 114 | Other editors generally require the `rust-analyzer` binary to be in `$PATH`. |
@@ -337,3 +325,47 @@ They are usually triggered by a shortcut or by clicking a light bulb icon in the | |||
337 | Cursor position or selection is signified by `┃` character. | 325 | Cursor position or selection is signified by `┃` character. |
338 | 326 | ||
339 | include::./generated_assists.adoc[] | 327 | include::./generated_assists.adoc[] |
328 | |||
329 | == Editor Features | ||
330 | === VS Code | ||
331 | ==== Special `when` clause context for keybindings. | ||
332 | You may use `inRustProject` context to configure keybindings for rust projects only. For example: | ||
333 | [source,json] | ||
334 | ---- | ||
335 | { | ||
336 | "key": "ctrl+i", | ||
337 | "command": "rust-analyzer.toggleInlayHints", | ||
338 | "when": "inRustProject" | ||
339 | } | ||
340 | ---- | ||
341 | More about `when` clause contexts https://code.visualstudio.com/docs/getstarted/keybindings#_when-clause-contexts[here]. | ||
342 | |||
343 | ==== Setting runnable environment variables | ||
344 | You can use "rust-analyzer.runnableEnv" setting to define runnable environment-specific substitution variables. | ||
345 | The simplest way for all runnables in a bunch: | ||
346 | ```jsonc | ||
347 | "rust-analyzer.runnableEnv": { | ||
348 | "RUN_SLOW_TESTS": "1" | ||
349 | } | ||
350 | ``` | ||
351 | |||
352 | Or it is possible to specify vars more granularly: | ||
353 | ```jsonc | ||
354 | "rust-analyzer.runnableEnv": [ | ||
355 | { | ||
356 | // "mask": null, // null mask means that this rule will be applied for all runnables | ||
357 | env: { | ||
358 | "APP_ID": "1", | ||
359 | "APP_DATA": "asdf" | ||
360 | } | ||
361 | }, | ||
362 | { | ||
363 | "mask": "test_name", | ||
364 | "env": { | ||
365 | "APP_ID": "2", // overwrites only APP_ID | ||
366 | } | ||
367 | } | ||
368 | ] | ||
369 | ``` | ||
370 | |||
371 | 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. | ||