From 469cd18285b6722ef0911a1f5d380aa3a63cdbf4 Mon Sep 17 00:00:00 2001 From: yCodeTech Date: Tue, 4 Aug 2026 03:29:04 +0100 Subject: [PATCH 1/4] remove: logging of "Other System Env Variables" with a dump of process.env. The env variables could potentially have some sensitive information, so we shouldn't dump all env vars. The majority of them don't seem to be useful for debugging anyway. - Removed dumping `process.env`. --- src/configuration.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/configuration.ts b/src/configuration.ts index 1704b6b..5c940bb 100644 --- a/src/configuration.ts +++ b/src/configuration.ts @@ -1019,7 +1019,6 @@ export class Configuration { "Host": vscode.env.appHost, ...extensionsPaths, }, - "Other System Env Variables": process.env, }; logger.debug("Environment:", env); From fab358275023320ce0c762a359bf6d7f8a8223a3 Mon Sep 17 00:00:00 2001 From: yCodeTech Date: Tue, 4 Aug 2026 03:29:47 +0100 Subject: [PATCH 2/4] feat: add additional handpicked environment variables to debug logging - Added handpicked env vars to be logged in `logDebugInfo` Configuration method: - VScode's `appRoot` env var. - Env vars that start with `VSCODE_` in `process.env`. --- src/configuration.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/configuration.ts b/src/configuration.ts index 5c940bb..b8c2f5e 100644 --- a/src/configuration.ts +++ b/src/configuration.ts @@ -1017,7 +1017,9 @@ export class Configuration { "Version": vscode.version, "Remote Name": vscode.env.remoteName || "local", "Host": vscode.env.appHost, + "App Root": vscode.env.appRoot, ...extensionsPaths, + "Env Vars": Object.fromEntries(Object.entries(process.env).filter(([key]) => key.startsWith("VSCODE_"))), }, }; logger.debug("Environment:", env); From b674609f916c6adecbd27e9cde564a6e6418734f Mon Sep 17 00:00:00 2001 From: yCodeTech Date: Tue, 4 Aug 2026 03:30:22 +0100 Subject: [PATCH 3/4] remove: logging extension discovery paths in `logDebugInfo`. - Removed logging of the extension discovery paths as they are already logged from the extension file, so these are redundant. - Added code comments to the various debug logs to make it easier to scan read. --- src/configuration.ts | 33 ++++++++------------------------- 1 file changed, 8 insertions(+), 25 deletions(-) diff --git a/src/configuration.ts b/src/configuration.ts index b8c2f5e..fa0f455 100644 --- a/src/configuration.ts +++ b/src/configuration.ts @@ -986,30 +986,6 @@ export class Configuration { return; } - // The path to the built-in extensions. The env variable changes when on WSL. - // So we can use it for both Windows and WSL. - const builtInExtensionsPath = this.extensionData.getExtensionDiscoveryPath("builtInExtensionsPath"); - - let extensionsPaths: JsonObject = {}; - - if (isWsl) { - // Get the Windows user and built-in extensions paths. - const windowsUserExtensionsPath = this.extensionData.getExtensionDiscoveryPath("WindowsUserExtensionsPathFromWsl"); - const windowsBuiltInExtensionsPath = this.extensionData.getExtensionDiscoveryPath("WindowsBuiltInExtensionsPathFromWsl"); - - extensionsPaths = { - "Windows-installed Built-in Extensions Path": windowsBuiltInExtensionsPath, - "Windows-installed User Extensions Path": windowsUserExtensionsPath, - "WSL-installed Built-in Extensions Path": builtInExtensionsPath, - "WSL-installed User Extensions Path": this.extensionData.getExtensionDiscoveryPath("userExtensionsPath"), - }; - } else { - extensionsPaths = { - "Built-in Extensions Path": builtInExtensionsPath, - "User Extensions Path": this.extensionData.getExtensionDiscoveryPath("userExtensionsPath"), - }; - } - const env: JsonObject = { "OS": process.platform, "Platform": process.platform, @@ -1018,7 +994,6 @@ export class Configuration { "Remote Name": vscode.env.remoteName || "local", "Host": vscode.env.appHost, "App Root": vscode.env.appRoot, - ...extensionsPaths, "Env Vars": Object.fromEntries(Object.entries(process.env).filter(([key]) => key.startsWith("VSCODE_"))), }, }; @@ -1028,12 +1003,20 @@ export class Configuration { logger.debug("Configuration settings:", this.getConfiguration()); // Log the objects for debugging purposes. + + // Lang Config Filepaths. logger.debug("The language config filepaths found are:", this.languageConfigFilePaths); + + // Lang Configs. logger.debug("The language configs found are:", this.languageConfigs); + + // Multi-line language definitions. logger.debug( "The supported languages for multi-line blocks:", utils.readJsonFile(this.multiLineLangDefinitionFilePath) ); + + // Single-line language definitions. logger.debug( "The supported languages for single-line blocks:", utils.readJsonFile(this.singleLineLangDefinitionFilePath) From 2096a70bb864110f30e46c92e210416cfc7afeb1 Mon Sep 17 00:00:00 2001 From: yCodeTech Date: Tue, 4 Aug 2026 23:26:00 +0100 Subject: [PATCH 4/4] fix: filter environment variables to include only string values. `process.env` values are typed as `string|undefined` and `undefined` isn't assignable to `JsonValue` in the `JsonObject` of the env object. So we need a type predicate to make sure the entry IS string, and a type guard to discard any values that are undefined. - Fixed the logging of environment variables filter to ensure that only string values are included for keys starting with "VSCODE_". --- src/configuration.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/configuration.ts b/src/configuration.ts index fa0f455..720870e 100644 --- a/src/configuration.ts +++ b/src/configuration.ts @@ -994,7 +994,12 @@ export class Configuration { "Remote Name": vscode.env.remoteName || "local", "Host": vscode.env.appHost, "App Root": vscode.env.appRoot, - "Env Vars": Object.fromEntries(Object.entries(process.env).filter(([key]) => key.startsWith("VSCODE_"))), + "Env Vars": Object.fromEntries( + Object.entries(process.env).filter((entry): entry is [string, string] => { + const [key, value] = entry; + return key.startsWith("VSCODE_") && typeof value === "string"; + }) + ), }, }; logger.debug("Environment:", env);