Skip to content

always runs in active terminal #1619

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 8, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"publisher": "ms-vscode",
"description": "Develop PowerShell scripts in Visual Studio Code!",
"engines": {
"vscode": "^1.25.0"
"vscode": "^1.29.0"
},
"license": "SEE LICENSE IN LICENSE.txt",
"homepage": "https://github.com/PowerShell/vscode-powershell/blob/master/README.md",
Expand Down Expand Up @@ -46,8 +46,8 @@
"mocha": "~4.0.1",
"tslint": "~5.11.0",
"typescript": "~3.2.1",
"vsce": "~1.46.0",
"vscode": "~1.1.22"
"vsce": "~1.53.2",
"vscode": "~1.1.24"
},
"extensionDependencies": [
"vscode.powershell"
Expand Down
14 changes: 14 additions & 0 deletions src/features/Console.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { LanguageClient, NotificationType, RequestType } from "vscode-languagecl
import { ICheckboxQuickPickItem, showCheckboxQuickPick } from "../controls/checkboxQuickPick";
import { IFeature } from "../feature";
import { Logger } from "../logging";
import Settings = require("../settings");

export const EvaluateRequestType = new RequestType<IEvaluateRequestArguments, void, void, void>("evaluate");
export const OutputNotificationType = new NotificationType<IOutputNotificationBody, void>("output");
Expand Down Expand Up @@ -210,6 +211,19 @@ export class ConsoleFeature implements IFeature {
return;
}

if (vscode.window.activeTerminal.name !== "PowerShell Integrated Console") {
this.log.write("PSIC is not active terminal. Running in active terminal using 'runSelectedText'");
await vscode.commands.executeCommand("workbench.action.terminal.runSelectedText");

// We need to honor the focusConsoleOnExecute setting here too. However, the boolean that `show`
// takes is called `preserveFocus` which when `true` the terminal will not take focus.
// This is the inverse of focusConsoleOnExecute so we have to inverse the boolean.
vscode.window.activeTerminal.show(!Settings.load().integratedConsole.focusConsoleOnExecute);
await vscode.commands.executeCommand("workbench.action.terminal.scrollToBottom");

return;
}

const editor = vscode.window.activeTextEditor;
let selectionRange: vscode.Range;

Expand Down