diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-07-03 14:17:36 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2020-07-03 14:17:36 +0100 |
commit | 84891455832ba871e1c5a6908ac798b7627c0c70 (patch) | |
tree | a0f4fb16c857d759b9f95e5d9322080fe76101b5 /editors/code/package.json | |
parent | f51b0cfdd6c23dd57a0a11154179730171c0425d (diff) | |
parent | 188d24024cd2770822d3e525be3ea330e79625c8 (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 'editors/code/package.json')
-rw-r--r-- | editors/code/package.json | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/editors/code/package.json b/editors/code/package.json index af0a5c851..7c8b2fbec 100644 --- a/editors/code/package.json +++ b/editors/code/package.json | |||
@@ -344,6 +344,35 @@ | |||
344 | "default": null, | 344 | "default": null, |
345 | "description": "Custom cargo runner extension ID." | 345 | "description": "Custom cargo runner extension ID." |
346 | }, | 346 | }, |
347 | "rust-analyzer.runnableEnv": { | ||
348 | "anyOf": [ | ||
349 | { | ||
350 | "type": "null" | ||
351 | }, | ||
352 | { | ||
353 | "type": "array", | ||
354 | "items": { | ||
355 | "type": "object", | ||
356 | "properties": { | ||
357 | "mask": { | ||
358 | "type": "string", | ||
359 | "description": "Runnable name mask" | ||
360 | }, | ||
361 | "env": { | ||
362 | "type": "object", | ||
363 | "description": "Variables in form of { \"key\": \"value\"}" | ||
364 | } | ||
365 | } | ||
366 | } | ||
367 | }, | ||
368 | { | ||
369 | "type": "object", | ||
370 | "description": "Variables in form of { \"key\": \"value\"}" | ||
371 | } | ||
372 | ], | ||
373 | "default": null, | ||
374 | "description": "Environment variables passed to the runnable launched using `Test ` or `Debug` lens or `rust-analyzer.run` command." | ||
375 | }, | ||
347 | "rust-analyzer.inlayHints.enable": { | 376 | "rust-analyzer.inlayHints.enable": { |
348 | "type": "boolean", | 377 | "type": "boolean", |
349 | "default": true, | 378 | "default": true, |