Skip to content

Commit 9041630

Browse files
committed
Merge pull request PowerShell#70 from janegilring/OpenInISE
Open in PowerShell ISE
2 parents 607b628 + 2573dd1 commit 9041630

File tree

3 files changed

+40
-0
lines changed

3 files changed

+40
-0
lines changed

package.json

+11
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,12 @@
5555
"key": "f8",
5656
"when": "editorTextFocus && editorLangId == 'powershell'"
5757
}
58+
,
59+
{
60+
"command": "PowerShell.OpenInISE",
61+
"key": "ctrl+alt+i",
62+
"when": "editorTextFocus && editorLangId == 'powershell'"
63+
}
5864
],
5965
"commands": [
6066
{
@@ -71,6 +77,11 @@
7177
"command": "PowerShell.RunSelection",
7278
"title": "Run selection",
7379
"category": "PowerShell"
80+
},
81+
{
82+
"command": "PowerShell.OpenInISE",
83+
"title": "Open current file in PowerShell ISE",
84+
"category": "PowerShell"
7485
}
7586
],
7687
"snippets": [

src/features/OpenInISE.ts

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import vscode = require('vscode');
2+
import Window = vscode.window;
3+
4+
export function registerOpenInISECommand(): void {
5+
var disposable = vscode.commands.registerCommand('PowerShell.OpenInISE', () => {
6+
7+
var editor = Window.activeTextEditor;
8+
var document = editor.document;
9+
10+
var uri = document.uri
11+
12+
if (process.env.hasOwnProperty('PROCESSOR_ARCHITEW6432')) {
13+
14+
var ISEPath = process.env.windir + '\\Sysnative\\WindowsPowerShell\\v1.0\\powershell_ise.exe';
15+
16+
} else
17+
{
18+
19+
var ISEPath = process.env.windir + '\\System32\\WindowsPowerShell\\v1.0\\powershell_ise.exe';
20+
21+
}
22+
23+
require("child_process").exec(ISEPath + ' -File ' + uri.fsPath).unref();
24+
25+
26+
});
27+
}

src/main.ts

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { LanguageClient, LanguageClientOptions, Executable } from 'vscode-langua
1212
import { RequestType, NotificationType, ResponseError } from 'vscode-jsonrpc';
1313
import { registerExpandAliasCommand } from './features/ExpandAlias';
1414
import { registerShowHelpCommand } from './features/ShowOnlineHelp';
15+
import { registerOpenInISECommand } from './features/OpenInISE';
1516
import { registerConsoleCommands } from './features/Console';
1617

1718
var languageServerClient : LanguageClient = undefined;
@@ -101,6 +102,7 @@ export function activate(context: vscode.ExtensionContext): void {
101102
registerExpandAliasCommand(languageServerClient);
102103
registerShowHelpCommand(languageServerClient);
103104
registerConsoleCommands(languageServerClient);
105+
registerOpenInISECommand();
104106
}
105107

106108
export function deactivate(): void {

0 commit comments

Comments
 (0)