Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 13 additions & 7 deletions src/features/Console.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,25 @@ export function registerConsoleCommands(client: LanguageClient): void {

vscode.commands.registerCommand('PowerShell.RunSelection', () => {
var editor = vscode.window.activeTextEditor;

client.sendRequest(EvaluateRequest.type, {
var start = editor.selection.start;
var end = editor.selection.end;
if(editor.selection.isEmpty){
start = new vscode.Position(start.line, 0)
}
client.sendRequest(EvaluateRequest.type, {
expression:
editor.document.getText(
new vscode.Range(
editor.selection.anchor,
editor.selection.active))
new vscode.Range(start, end))
});
});

var consoleChannel = vscode.window.createOutputChannel("PowerShell Output");
client.onNotification(OutputNotification.type, (output) => {
consoleChannel.show(vscode.ViewColumn.Three);
var outputEditorExist = vscode.window.visibleTextEditors.some((editor) => {
return editor.document.languageId == 'Log'
});
if(!outputEditorExist)
consoleChannel.show(vscode.ViewColumn.Three);
consoleChannel.append(output.output);
});
}
}