File tree Expand file tree Collapse file tree 1 file changed +13
-7
lines changed Expand file tree Collapse file tree 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 {
2525
2626vscode . commands . registerCommand ( 'PowerShell.RunSelection' , ( ) => {
2727var 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 , {
3034expression :
3135editor . document . getText (
32- new vscode . Range (
33- editor . selection . anchor ,
34- editor . selection . active ) )
36+ new vscode . Range ( start , end ) )
3537} ) ;
3638} ) ;
3739
3840var consoleChannel = vscode . window . createOutputChannel ( "PowerShell Output" ) ;
3941client . 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 ) ;
4147consoleChannel . append ( output . output ) ;
4248} ) ;
43- }
49+ }
You can’t perform that action at this time.
0 commit comments