aboutsummaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-07-03 14:17:36 +0100
committerGitHub <[email protected]>2020-07-03 14:17:36 +0100
commit84891455832ba871e1c5a6908ac798b7627c0c70 (patch)
treea0f4fb16c857d759b9f95e5d9322080fe76101b5 /docs
parentf51b0cfdd6c23dd57a0a11154179730171c0425d (diff)
parent188d24024cd2770822d3e525be3ea330e79625c8 (diff)
Merge #5202
5202: Runnable env r=matklad a=vsrs This PR adds on option to specify (in the settings.json) environment variables passed to the runnable. The simplest way for all runnables in a bunch: ```jsonc "rust-analyzer.runnableEnv": { "RUN_SLOW_TESTS": "1" } ``` Or it is possible to specify vars more granularly: ```jsonc "rust-analyzer.runnableEnv": [ { // "mask": null, // null mask means that this rule will be applied for all runnables env: { "APP_ID": "1", "APP_DATA": "asdf" } }, { "mask": "test_name", "env": { "APP_ID": "2", // overwrites only APP_ID } } ] ``` 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. Fixes #4450 I suppose this info should be somewhere in the docs, but unsure where is the best place. Co-authored-by: vsrs <[email protected]>
Diffstat (limited to 'docs')
-rw-r--r--docs/user/manual.adoc56
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.
113You 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----
122More 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
126Other editors generally require the `rust-analyzer` binary to be in `$PATH`. 114Other 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
337Cursor position or selection is signified by `┃` character. 325Cursor position or selection is signified by `┃` character.
338 326
339include::./generated_assists.adoc[] 327include::./generated_assists.adoc[]
328
329== Editor Features
330=== VS Code
331==== Special `when` clause context for keybindings.
332You 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----
341More about `when` clause contexts https://code.visualstudio.com/docs/getstarted/keybindings#_when-clause-contexts[here].
342
343==== Setting runnable environment variables
344You can use "rust-analyzer.runnableEnv" setting to define runnable environment-specific substitution variables.
345The simplest way for all runnables in a bunch:
346```jsonc
347"rust-analyzer.runnableEnv": {
348 "RUN_SLOW_TESTS": "1"
349}
350```
351
352Or 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
371You 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.