Skip to content
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

Refresh the terminal if the default changes #2408

Merged
merged 3 commits into from
Mar 1, 2022
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Improvements:
- Support for the Ninja Multi-Config generator. [#1423](https://github.com/microsoft/vscode-cmake-tools/issues/1423)
- Minimize build progress notification to the status bar. [#2308](https://github.com/microsoft/vscode-cmake-tools/issues/2308)
- Allow editing Kits when presets are in use. [#1965](https://github.com/microsoft/vscode-cmake-tools/issues/1965)
- Launch the target in the default terminal. [PR #2311](https://github.com/microsoft/vscode-cmake-tools/pull/2311) [@michallukowski](https://github.com/michallukowski)

Bug Fixes:
- CMakePrests.json toolset requires the VS version instead of the toolset version. [#1965](https://github.com/microsoft/vscode-cmake-tools/issues/1965)
Expand Down
7 changes: 7 additions & 0 deletions src/cmake-tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2138,6 +2138,7 @@ export class CMakeTools implements vscode.Disposable, api.CMakeToolsAPI {
}

private _launchTerminal?: vscode.Terminal;
private _lastTerminal?: string;
// Watch for the user closing our terminal
private readonly _termCloseSub = vscode.window.onDidCloseTerminal(term => {
if (term === this._launchTerminal) {
Expand Down Expand Up @@ -2176,6 +2177,12 @@ export class CMakeTools implements vscode.Disposable, api.CMakeToolsAPI {
}
}

if (this._lastTerminal !== vscode.env.shell) {
void this._launchTerminal?.dispose();
this._launchTerminal = undefined;
}
this._lastTerminal = vscode.env.shell;

if (!this._launchTerminal) {
this._launchTerminal = vscode.window.createTerminal(termOptions);
}
Expand Down