diff options
Diffstat (limited to 'docs')
-rw-r--r-- | docs/user/manual.adoc | 58 |
1 files changed, 46 insertions, 12 deletions
diff --git a/docs/user/manual.adoc b/docs/user/manual.adoc index b763958fe..ede21ed9b 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,49 @@ 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 | [source,jsonc] | ||
347 | --- | ||
348 | "rust-analyzer.runnableEnv": { | ||
349 | "RUN_SLOW_TESTS": "1" | ||
350 | } | ||
351 | --- | ||
352 | |||
353 | Or it is possible to specify vars more granularly: | ||
354 | [source,jsonc] | ||
355 | --- | ||
356 | "rust-analyzer.runnableEnv": [ | ||
357 | { | ||
358 | // "mask": null, // null mask means that this rule will be applied for all runnables | ||
359 | env: { | ||
360 | "APP_ID": "1", | ||
361 | "APP_DATA": "asdf" | ||
362 | } | ||
363 | }, | ||
364 | { | ||
365 | "mask": "test_name", | ||
366 | "env": { | ||
367 | "APP_ID": "2", // overwrites only APP_ID | ||
368 | } | ||
369 | } | ||
370 | ] | ||
371 | --- | ||
372 | |||
373 | 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. | ||