Skip to content

Commit 120a92c

Browse files
committed
Add PowerShell.ShowSessionOutput command
This change adds a new command called "Show Session Output" to make it easy for the user (or another code component) to invoke the PowerShell Output pane.
1 parent 2f5fcec commit 120a92c

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

package.json

+5
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,11 @@
128128
"command": "PowerShell.SelectPSSARules",
129129
"title": "Select PSScriptAnalyzer Rules",
130130
"category": "PowerShell"
131+
},
132+
{
133+
"command": "PowerShell.ShowSessionOutput",
134+
"title": "Show Session Output",
135+
"category": "PowerShell"
131136
}
132137
],
133138
"snippets": [

src/features/Console.ts

+10-4
Original file line numberDiff line numberDiff line change
@@ -144,12 +144,12 @@ function onInputEntered(responseText: string): ShowInputPromptResponseBody {
144144
}
145145

146146
export class ConsoleFeature implements IFeature {
147-
private command: vscode.Disposable;
147+
private commands: vscode.Disposable[];
148148
private languageClient: LanguageClient;
149149
private consoleChannel: vscode.OutputChannel;
150150

151151
constructor() {
152-
this.command =
152+
this.commands = [
153153
vscode.commands.registerCommand('PowerShell.RunSelection', () => {
154154
if (this.languageClient === undefined) {
155155
// TODO: Log error message
@@ -175,7 +175,13 @@ export class ConsoleFeature implements IFeature {
175175

176176
// Show the output window if it isn't already visible
177177
this.consoleChannel.show(vscode.ViewColumn.Three);
178-
});
178+
}),
179+
180+
vscode.commands.registerCommand('PowerShell.ShowSessionOutput', () => {
181+
// Show the output window if it isn't already visible
182+
this.consoleChannel.show(vscode.ViewColumn.Three);
183+
})
184+
];
179185

180186
this.consoleChannel = vscode.window.createOutputChannel("PowerShell Output");
181187
}
@@ -197,7 +203,7 @@ export class ConsoleFeature implements IFeature {
197203
}
198204

199205
public dispose() {
200-
this.command.dispose();
206+
this.commands.forEach(command => command.dispose());
201207
this.consoleChannel.dispose();
202208
}
203209
}

0 commit comments

Comments
 (0)