-
Notifications
You must be signed in to change notification settings - Fork 510
/
Copy pathOpenInISE.ts
36 lines (28 loc) · 1.05 KB
/
OpenInISE.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import ChildProcess = require("child_process");
import vscode = require("vscode");
export class OpenInISEFeature implements vscode.Disposable {
private command: vscode.Disposable;
constructor() {
this.command = vscode.commands.registerCommand("PowerShell.OpenInISE", () => {
const editor = vscode.window.activeTextEditor;
if (editor === undefined) {
return;
}
const document = editor.document;
const uri = document.uri;
let ISEPath = process.env.windir ?? "C:\\Windows";
if (process.env.PROCESSOR_ARCHITEW6432 !== undefined) {
ISEPath += "\\Sysnative";
} else {
ISEPath += "\\System32";
}
ISEPath += "\\WindowsPowerShell\\v1.0\\powershell_ise.exe";
ChildProcess.exec(`${ISEPath} -File "${uri.fsPath}"`).unref();
});
}
public dispose(): void {
this.command.dispose();
}
}