aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvsrs <[email protected]>2020-07-03 14:01:13 +0100
committerGitHub <[email protected]>2020-07-03 14:01:13 +0100
commitfd94a10be1e2656837b3b7c7d26f291c2c8cced6 (patch)
treed7a37fe8fdda5844b122ae307f254420b36fca9b
parentbebbfa1a29062a3e9304c80080316d8c4937e5bc (diff)
Add docs
-rw-r--r--docs/user/manual.adoc58
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.
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,49 @@ 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[source,jsonc]
347---
348"rust-analyzer.runnableEnv": {
349 "RUN_SLOW_TESTS": "1"
350}
351---
352
353Or 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
373You 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.