diff --git a/CHANGELOG.md b/CHANGELOG.md index 07996505b3..397c2be456 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,12 +6,16 @@ Improvements: Bug Fixes: - Compatibility between test and build presets was not enforced. [#2904](https://github.com/microsoft/vscode-cmake-tools/issues/2904) -- Update quote function to fix path separator regression [#2974](https://github.com/microsoft/vscode-cmake-tools/pull/2974) + +## 1.13.43 +Bug Fixes: +- Fix an issue causing the Add Presets commands not to appear. [PR #2977](https://github.com/microsoft/vscode-cmake-tools/pull/2977) ## 1.13.42 Bug Fixes: - Fix failed activation when using the `cmake.allowUnsupportedPresetsVersions` setting. [#2968](https://github.com/microsoft/vscode-cmake-tools/issues/2968) - Verify binary directories only if there are multiple sources. [#2963](https://github.com/microsoft/vscode-cmake-tools/issues/2963) +- Update quote function to fix path separator regression [#2974](https://github.com/microsoft/vscode-cmake-tools/pull/2974) ## 1.13.41 Bug Fixes: diff --git a/src/projectController.ts b/src/projectController.ts index 8abfe255fa..f7c1bcec9d 100644 --- a/src/projectController.ts +++ b/src/projectController.ts @@ -74,13 +74,13 @@ export class ProjectController implements vscode.Disposable { if (openEditor) { for (const project of projects) { if (util.isFileInsideFolder(openEditor.document, project.folderPath)) { - this.activeProject = project; + this.setActiveProject(project); break; } } if (!this.activeProject) { if (util.isFileInsideFolder(openEditor.document, projects[0].workspaceFolder.uri.fsPath)) { - this.activeProject = projects[0]; + this.setActiveProject(projects[0]); } } // If active project is found, return. @@ -89,15 +89,16 @@ export class ProjectController implements vscode.Disposable { } } else { // Set a default active project. - this.activeProject = projects[0]; + this.setActiveProject(projects[0]); return; } } - this.activeProject = undefined; + this.setActiveProject(undefined); } setActiveProject(project?: CMakeProject): void { this.activeProject = project; + void this.updateUsePresetsState(this.activeProject); } public getActiveCMakeProject(): CMakeProject | undefined { @@ -397,12 +398,16 @@ export class ProjectController implements vscode.Disposable { } } if (this.activeProject) { - const use: boolean = this.activeProject.useCMakePresets; - await util.setContextValue('useCMakePresets', use); - const statusBar: StatusBar | undefined = getStatusBar(); - if (statusBar) { - statusBar.useCMakePresets(use); - } + await this.updateUsePresetsState(this.activeProject); + } + } + + private async updateUsePresetsState(project?: CMakeProject): Promise { + const state: boolean = project?.useCMakePresets || false; + await util.setContextValue('useCMakePresets', state); + const statusBar: StatusBar | undefined = getStatusBar(); + if (statusBar) { + statusBar.useCMakePresets(state); } }