]> git.lizzy.rs Git - rust.git/commitdiff
Merge #5202
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>
Fri, 3 Jul 2020 13:17:36 +0000 (13:17 +0000)
committerGitHub <noreply@github.com>
Fri, 3 Jul 2020 13:17:36 +0000 (13:17 +0000)
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 <vit@conrlab.com>

Trivial merge