From 823f920231cff1c753e34e1b48b4c8467a808564 Mon Sep 17 00:00:00 2001 From: "Bob Brown (DEVDIV)" Date: Tue, 1 Mar 2022 10:11:20 -0800 Subject: [PATCH 1/2] Refresh the terminal when the default terminal changes --- CHANGELOG.md | 1 + src/cmake-tools.ts | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 15795ffc8..60ab1fffa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) diff --git a/src/cmake-tools.ts b/src/cmake-tools.ts index 76bd608c5..fde7a693d 100644 --- a/src/cmake-tools.ts +++ b/src/cmake-tools.ts @@ -2139,6 +2139,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) { @@ -2172,6 +2173,12 @@ export class CMakeTools implements vscode.Disposable, api.CMakeToolsAPI { termOptions.shellPath = paths.windows.ComSpec; } + if (this._lastTerminal !== vscode.env.shell) { + this._launchTerminal?.dispose(); + this._launchTerminal = undefined; + } + this._lastTerminal = vscode.env.shell; + if (!this._launchTerminal) { this._launchTerminal = vscode.window.createTerminal(termOptions); } From 8fae570e5980c9aae09dcbd22e0a795287a3088b Mon Sep 17 00:00:00 2001 From: "Bob Brown (DEVDIV)" Date: Tue, 1 Mar 2022 10:15:06 -0800 Subject: [PATCH 2/2] lint --- src/cmake-tools.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cmake-tools.ts b/src/cmake-tools.ts index fde7a693d..a62d34330 100644 --- a/src/cmake-tools.ts +++ b/src/cmake-tools.ts @@ -2174,7 +2174,7 @@ export class CMakeTools implements vscode.Disposable, api.CMakeToolsAPI { } if (this._lastTerminal !== vscode.env.shell) { - this._launchTerminal?.dispose(); + void this._launchTerminal?.dispose(); this._launchTerminal = undefined; } this._lastTerminal = vscode.env.shell;