Auto merge of #15138 - mohsen-alizadeh:13583-rename-runnableEnv-to-runnables-extraEnv, r=Veykril

13583 rename runnable env to runnables extra env

closes #13583
This commit is contained in:
bors 2023-06-29 07:18:57 +00:00
commit d7f4c21950
5 changed files with 8 additions and 8 deletions

View File

@ -933,17 +933,17 @@ For example:
More about `when` clause contexts https://code.visualstudio.com/docs/getstarted/keybindings#_when-clause-contexts[here]. More about `when` clause contexts https://code.visualstudio.com/docs/getstarted/keybindings#_when-clause-contexts[here].
==== Setting runnable environment variables ==== Setting runnable environment variables
You can use "rust-analyzer.runnableEnv" setting to define runnable environment-specific substitution variables. You can use "rust-analyzer.runnables.extraEnv" setting to define runnable environment-specific substitution variables.
The simplest way for all runnables in a bunch: The simplest way for all runnables in a bunch:
```jsonc ```jsonc
"rust-analyzer.runnableEnv": { "rust-analyzer.runnables.extraEnv": {
"RUN_SLOW_TESTS": "1" "RUN_SLOW_TESTS": "1"
} }
``` ```
Or it is possible to specify vars more granularly: Or it is possible to specify vars more granularly:
```jsonc ```jsonc
"rust-analyzer.runnableEnv": [ "rust-analyzer.runnables.extraEnv": [
{ {
// "mask": null, // null mask means that this rule will be applied for all runnables // "mask": null, // null mask means that this rule will be applied for all runnables
env: { env: {

View File

@ -311,7 +311,7 @@
"default": null, "default": null,
"description": "Custom cargo runner extension ID." "description": "Custom cargo runner extension ID."
}, },
"rust-analyzer.runnableEnv": { "rust-analyzer.runnables.extraEnv": {
"anyOf": [ "anyOf": [
{ {
"type": "null" "type": "null"

View File

@ -224,8 +224,8 @@ export class Config {
return this.get<string | undefined>("cargoRunner"); return this.get<string | undefined>("cargoRunner");
} }
get runnableEnv() { get runnablesExtraEnv() {
const item = this.get<any>("runnableEnv"); const item = this.get<any>("runnables.extraEnv") ?? this.get<any>("runnableEnv");
if (!item) return item; if (!item) return item;
const fixRecord = (r: Record<string, any>) => { const fixRecord = (r: Record<string, any>) => {
for (const key in r) { for (const key in r) {

View File

@ -118,7 +118,7 @@ async function getDebugConfiguration(
return path.normalize(p).replace(wsFolder, "${workspaceFolder" + workspaceQualifier + "}"); return path.normalize(p).replace(wsFolder, "${workspaceFolder" + workspaceQualifier + "}");
} }
const env = prepareEnv(runnable, ctx.config.runnableEnv); const env = prepareEnv(runnable, ctx.config.runnablesExtraEnv);
const executable = await getDebugExecutable(runnable, env); const executable = await getDebugExecutable(runnable, env);
let sourceFileMap = debugOptions.sourceFileMap; let sourceFileMap = debugOptions.sourceFileMap;
if (sourceFileMap === "auto") { if (sourceFileMap === "auto") {

View File

@ -140,7 +140,7 @@ export async function createTask(runnable: ra.Runnable, config: Config): Promise
command: args[0], // run, test, etc... command: args[0], // run, test, etc...
args: args.slice(1), args: args.slice(1),
cwd: runnable.args.workspaceRoot || ".", cwd: runnable.args.workspaceRoot || ".",
env: prepareEnv(runnable, config.runnableEnv), env: prepareEnv(runnable, config.runnablesExtraEnv),
overrideCargo: runnable.args.overrideCargo, overrideCargo: runnable.args.overrideCargo,
}; };