@@ -7,6 +7,7 @@ import { LanguageClient, NotificationType, RequestType } from "vscode-languagecl
77import { ICheckboxQuickPickItem , showCheckboxQuickPick } from "../controls/checkboxQuickPick" ;
88import { IFeature } from "../feature" ;
99import { Logger } from "../logging" ;
10+ import Settings = require( "../settings" ) ;
1011
1112export const EvaluateRequestType = new RequestType < IEvaluateRequestArguments , void , void , void > ( "evaluate" ) ;
1213export const OutputNotificationType = new NotificationType < IOutputNotificationBody , void > ( "output" ) ;
@@ -210,6 +211,20 @@ export class ConsoleFeature implements IFeature {
210211 return ;
211212 }
212213
214+ if ( vscode . window . activeTerminal &&
215+ vscode . window . activeTerminal . name !== "PowerShell Integrated Console" ) {
216+ this . log . write ( "PSIC is not active terminal. Running in active terminal using 'runSelectedText'" ) ;
217+ await vscode . commands . executeCommand ( "workbench.action.terminal.runSelectedText" ) ;
218+
219+ // We need to honor the focusConsoleOnExecute setting here too. However, the boolean that `show`
220+ // takes is called `preserveFocus` which when `true` the terminal will not take focus.
221+ // This is the inverse of focusConsoleOnExecute so we have to inverse the boolean.
222+ vscode . window . activeTerminal . show ( ! Settings . load ( ) . integratedConsole . focusConsoleOnExecute ) ;
223+ await vscode . commands . executeCommand ( "workbench.action.terminal.scrollToBottom" ) ;
224+
225+ return ;
226+ }
227+
213228 const editor = vscode . window . activeTextEditor ;
214229 let selectionRange : vscode . Range ;
215230
0 commit comments