Skip to content

Commit 4e790c8

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 b313aa8 commit 4e790c8

File tree

1 file changed

+29
-5
lines changed

1 file changed

+29
-5
lines changed

src/configuration.ts

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1076,14 +1076,38 @@ export class Configuration {
10761076
* Logs the environment, configuration settings, and language configs for debugging purposes.
10771077
*/
10781078
private logDebugInfo() {
1079+
// The path to the built-in extensions. The env variable changes when on WSL.
1080+
// So we can use it for both Windows and WSL.
1081+
const builtInExtensionsPath = path.join(vscode.env.appRoot, "extensions");
1082+
1083+
let extensionsPaths = {};
1084+
1085+
if (isWsl) {
1086+
// Get the Windows user and built-in extensions paths on Windows from WSL environment variables.
1087+
const {builtInExtensionsPathFromWsl, userExtensionsPathFromWsl} = this.getExtensionsPathsFromWslEnv();
1088+
1089+
extensionsPaths = {
1090+
"Windows-installed Built-in Extensions Path": builtInExtensionsPathFromWsl,
1091+
"Windows-installed User Extensions Path": userExtensionsPathFromWsl,
1092+
"WSL-installed Built-in Extensions Path": builtInExtensionsPath,
1093+
"WSL-installed User Extensions Path": path.join(vscode.env.appRoot, "../../", "extensions"),
1094+
};
1095+
} else {
1096+
extensionsPaths = {
1097+
"Built-in Extensions Path": builtInExtensionsPath,
1098+
"User Extensions Path": path.join(process.env.USERPROFILE, ".vscode", "extensions"),
1099+
};
1100+
}
1101+
10791102
const env = {
10801103
"OS": process.platform,
10811104
"Platform": process.platform,
1082-
"VS Code Version": vscode.version,
1083-
"VS Code Root Path": vscode.env.appRoot,
1084-
"VS Code Built-in Extensions Path": `${vscode.env.appRoot}\\extensions`,
1085-
"VS Code Host": vscode.env.appHost,
1086-
"VS Code Remote Name": vscode.env.remoteName || "local",
1105+
"VS Code Details": {
1106+
"Version": vscode.version,
1107+
"Remote Name": vscode.env.remoteName || "local",
1108+
"Host": vscode.env.appHost,
1109+
...extensionsPaths,
1110+
},
10871111
"Other System Env Variables": process.env,
10881112
};
10891113
this.logger.debug("Environment:", env);

0 commit comments

Comments
 (0)