Skip to content

Commit 21bdd89

Browse files
committed
refactor: logDebugInfo method to log different stuff when on WSL.
Added: - Added an `isWsl` check, and uses the new `getExtensionsPathsFromWslEnv` method to log the Windows extensions paths from WSL. Changed: - Refactored all "VS Code" items into a new object so that we're not repeating "VS Code" multiple times. This makes for a better reading experience.
1 parent 7fe2f04 commit 21bdd89

1 file changed

Lines changed: 29 additions & 5 deletions

File tree

src/configuration.ts

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1068,14 +1068,38 @@ export class Configuration {
10681068
* Logs the environment, configuration settings, and language configs for debugging purposes.
10691069
*/
10701070
private logDebugInfo() {
1071+
// The path to the built-in extensions. The env variable changes when on WSL.
1072+
// So we can use it for both Windows and WSL.
1073+
const builtInExtensionsPath = path.join(vscode.env.appRoot, "extensions");
1074+
1075+
let extensionsPaths = {};
1076+
1077+
if (isWsl) {
1078+
// Get the Windows user and built-in extensions paths on Windows from WSL environment variables.
1079+
const {builtInExtensionsPathFromWsl, userExtensionsPathFromWsl} = this.getExtensionsPathsFromWslEnv();
1080+
1081+
extensionsPaths = {
1082+
"Windows-installed Built-in Extensions Path": builtInExtensionsPathFromWsl,
1083+
"Windows-installed User Extensions Path": userExtensionsPathFromWsl,
1084+
"WSL-installed Built-in Extensions Path": builtInExtensionsPath,
1085+
"WSL-installed User Extensions Path": path.join(vscode.env.appRoot, "../../", "extensions"),
1086+
};
1087+
} else {
1088+
extensionsPaths = {
1089+
"Built-in Extensions Path": builtInExtensionsPath,
1090+
"User Extensions Path": path.join(process.env.USERPROFILE, ".vscode", "extensions"),
1091+
};
1092+
}
1093+
10711094
const env = {
10721095
"OS": process.platform,
10731096
"Platform": process.platform,
1074-
"VS Code Version": vscode.version,
1075-
"VS Code Root Path": vscode.env.appRoot,
1076-
"VS Code Built-in Extensions Path": `${vscode.env.appRoot}\\extensions`,
1077-
"VS Code Host": vscode.env.appHost,
1078-
"VS Code Remote Name": vscode.env.remoteName || "local",
1097+
"VS Code Details": {
1098+
"Version": vscode.version,
1099+
"Remote Name": vscode.env.remoteName || "local",
1100+
"Host": vscode.env.appHost,
1101+
...extensionsPaths,
1102+
},
10791103
"Other System Env Variables": process.env,
10801104
};
10811105
this.logger.debug("Environment:", env);

0 commit comments

Comments
 (0)