Skip to content

Commit 020f755

Browse files
committed
If selection empty run current line
1 parent cf21f5d commit 020f755

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/features/Console.ts

+7-5
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,15 @@ export function registerConsoleCommands(client: LanguageClient): void {
2525

2626
vscode.commands.registerCommand('PowerShell.RunSelection', () => {
2727
var editor = vscode.window.activeTextEditor;
28-
29-
client.sendRequest(EvaluateRequest.type, {
28+
var start = editor.selection.start;
29+
var end = editor.selection.end;
30+
if(editor.selection.isEmpty){
31+
start = new vscode.Position(start.line, 0)
32+
}
33+
client.sendRequest(EvaluateRequest.type, {
3034
expression:
3135
editor.document.getText(
32-
new vscode.Range(
33-
editor.selection.anchor,
34-
editor.selection.active))
36+
new vscode.Range(start, end))
3537
});
3638
});
3739

0 commit comments

Comments
 (0)