From d1aa6d32167be4b4916399f87520e3c3cea44aed Mon Sep 17 00:00:00 2001 From: Jake Heinz Date: Tue, 24 May 2022 02:59:19 +0000 Subject: [PATCH] vscode: fix extraEnv handling numeric values --- editors/code/package.json | 3 +++ editors/code/src/config.ts | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/editors/code/package.json b/editors/code/package.json index f46c7ea92d..1cbbe9ee71 100644 --- a/editors/code/package.json +++ b/editors/code/package.json @@ -308,6 +308,9 @@ "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 592ebe0ce3..9d9392d2a5 100644 --- a/editors/code/src/config.ts +++ b/editors/code/src/config.ts @@ -100,8 +100,9 @@ export class Config { get serverPath() { return this.get("server.path") ?? this.get("serverPath"); } - get serverExtraEnv() { - return this.get("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("trace.extension");