Skip to content

Commit fd94a10

Browse files
authored
Add docs
1 parent bebbfa1 commit fd94a10

File tree

1 file changed

+46
-12
lines changed

1 file changed

+46
-12
lines changed

docs/user/manual.adoc

Lines changed: 46 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -109,18 +109,6 @@ Here are some useful self-diagnostic commands:
109109
* To log all LSP requests, add `"rust-analyzer.trace.server": "verbose"` to the settings and look for `Server Trace` in the panel.
110110
* To enable client-side logging, add `"rust-analyzer.trace.extension": true` to the settings and open the `Console` tab of VS Code developer tools.
111111

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-
124112
=== rust-analyzer Language Server Binary
125113

126114
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
337325
Cursor position or selection is signified by `┃` character.
338326

339327
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.

0 commit comments

Comments
 (0)