@microsoft/inshellisense 0.0.1-rc.2 → 0.0.1-rc.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/utils/bindings.js +25 -5
- package/package.json +1 -1
package/build/utils/bindings.js
CHANGED
|
@@ -39,12 +39,32 @@ const pwshScriptCommand = () => {
|
|
|
39
39
|
return `if(Test-Path '${bindingsPath}' -PathType Leaf){. ${bindingsPath}}`;
|
|
40
40
|
};
|
|
41
41
|
const pwshConfigPath = async () => {
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
try {
|
|
43
|
+
const { stdout } = await execAsync("echo $profile", { shell: "pwsh" });
|
|
44
|
+
return stdout.trim();
|
|
45
|
+
}
|
|
46
|
+
catch {
|
|
47
|
+
/* empty */
|
|
48
|
+
}
|
|
49
|
+
switch (process.platform) {
|
|
50
|
+
case "win32":
|
|
51
|
+
return path.join(os.homedir(), "Documents", "Powershell", "Microsoft.PowerShell_profile.ps1");
|
|
52
|
+
case "linux":
|
|
53
|
+
case "darwin":
|
|
54
|
+
return path.join(os.homedir(), ".config", "powershell", "Microsoft.PowerShell_profile.ps1");
|
|
55
|
+
default:
|
|
56
|
+
throw new Error("Unsupported platform");
|
|
57
|
+
}
|
|
44
58
|
};
|
|
45
59
|
const powershellConfigPath = async () => {
|
|
46
|
-
|
|
47
|
-
|
|
60
|
+
try {
|
|
61
|
+
const { stdout } = await execAsync("echo $profile", { shell: "powershell" });
|
|
62
|
+
return stdout.trim();
|
|
63
|
+
}
|
|
64
|
+
catch {
|
|
65
|
+
/* empty */
|
|
66
|
+
}
|
|
67
|
+
return path.join(os.homedir(), "Documents", "WindowsPowershell", "Microsoft.PowerShell_profile.ps1");
|
|
48
68
|
};
|
|
49
69
|
export const availableBindings = async () => {
|
|
50
70
|
const cliConfigPath = path.join(os.homedir(), cacheFolder);
|
|
@@ -82,8 +102,8 @@ export const availableBindings = async () => {
|
|
|
82
102
|
bindings.push(Shell.Fish);
|
|
83
103
|
}
|
|
84
104
|
}
|
|
85
|
-
const powershellResolvedConfigPath = await powershellConfigPath();
|
|
86
105
|
if (process.platform == "win32") {
|
|
106
|
+
const powershellResolvedConfigPath = await powershellConfigPath();
|
|
87
107
|
if (!fs.existsSync(powershellResolvedConfigPath)) {
|
|
88
108
|
bindings.push(Shell.Powershell);
|
|
89
109
|
}
|