diff options
| author | bors <bors@rust-lang.org> | 2022-05-24 04:11:19 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-05-24 04:11:19 +0000 |
| commit | cc8140a7c71764e5f2b7ba0db5cd4a5cc7d87926 (patch) | |
| tree | 98c446cf86ec16a429cb81025f42ad86e83bfdee | |
| parent | 81805d4cfc2bb307d911806dffb6eabf29b623e3 (diff) | |
| parent | b8ee992b5799d78869e97b026e974942c9cdf14c (diff) | |
| download | rust-cc8140a7c71764e5f2b7ba0db5cd4a5cc7d87926.tar.gz rust-cc8140a7c71764e5f2b7ba0db5cd4a5cc7d87926.zip | |
Auto merge of #12371 - jhgg:fix/extra-env-non-string-value-handling, r=lnicola
vscode: fix extraEnv handling numeric values fixes #12363 by bringing the types more inline with the reality, and making `Env` not a lie.
| -rw-r--r-- | editors/code/package.json | 6 | ||||
| -rw-r--r-- | editors/code/src/config.ts | 8 |
2 files changed, 12 insertions, 2 deletions
diff --git a/editors/code/package.json b/editors/code/package.json index f46c7ea92d3..18fa7f2f4c7 100644 --- a/editors/code/package.json +++ b/editors/code/package.json @@ -308,6 +308,12 @@ "null", "object" ], + "additionalProperties": { + "type": [ + "string", + "number" + ] + }, "default": null, "markdownDescription": "Extra environment variables that will be passed to the rust-analyzer executable. Useful for passing e.g. `RA_LOG` for debugging." }, diff --git a/editors/code/src/config.ts b/editors/code/src/config.ts index 592ebe0ce33..d07e47c8de9 100644 --- a/editors/code/src/config.ts +++ b/editors/code/src/config.ts @@ -100,8 +100,12 @@ export class Config { get serverPath() { return this.get<null | string>("server.path") ?? this.get<null | string>("serverPath"); } - get serverExtraEnv() { - return this.get<Env | null>("server.extraEnv") ?? {}; + get serverExtraEnv(): Env { + const extraEnv = + this.get<{ [key: string]: string | number } | null>("server.extraEnv") ?? {}; + return Object.fromEntries( + Object.entries(extraEnv).map(([k, v]) => [k, typeof v !== "string" ? v.toString() : v]) + ); } get traceExtension() { return this.get<boolean>("trace.extension"); |
