@@ -7,6 +7,7 @@ import { LanguageClient, NotificationType, RequestType } from "vscode-languagecl
7
7
import { ICheckboxQuickPickItem , showCheckboxQuickPick } from "../controls/checkboxQuickPick" ;
8
8
import { IFeature } from "../feature" ;
9
9
import { Logger } from "../logging" ;
10
+ import Settings = require( "../settings" ) ;
10
11
11
12
export const EvaluateRequestType = new RequestType < IEvaluateRequestArguments , void , void , void > ( "evaluate" ) ;
12
13
export const OutputNotificationType = new NotificationType < IOutputNotificationBody , void > ( "output" ) ;
@@ -210,6 +211,20 @@ export class ConsoleFeature implements IFeature {
210
211
return ;
211
212
}
212
213
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
+
213
228
const editor = vscode . window . activeTextEditor ;
214
229
let selectionRange : vscode . Range ;
215
230
0 commit comments