File tree 1 file changed +13
-7
lines changed
1 file changed +13
-7
lines changed Original file line number Diff line number Diff line change @@ -25,19 +25,25 @@ export function registerConsoleCommands(client: LanguageClient): void {
25
25
26
26
vscode . commands . registerCommand ( 'PowerShell.RunSelection' , ( ) => {
27
27
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 , {
30
34
expression :
31
35
editor . document . getText (
32
- new vscode . Range (
33
- editor . selection . anchor ,
34
- editor . selection . active ) )
36
+ new vscode . Range ( start , end ) )
35
37
} ) ;
36
38
} ) ;
37
39
38
40
var consoleChannel = vscode . window . createOutputChannel ( "PowerShell Output" ) ;
39
41
client . onNotification ( OutputNotification . type , ( output ) => {
40
- consoleChannel . show ( vscode . ViewColumn . Three ) ;
42
+ var outputEditorExist = vscode . window . visibleTextEditors . some ( ( editor ) => {
43
+ return editor . document . languageId == 'Log'
44
+ } ) ;
45
+ if ( ! outputEditorExist )
46
+ consoleChannel . show ( vscode . ViewColumn . Three ) ;
41
47
consoleChannel . append ( output . output ) ;
42
48
} ) ;
43
- }
49
+ }
You can’t perform that action at this time.
0 commit comments