Skip to content

Commit 2f8f1fc

Browse files
authored
Fix an issue causing the Add Presets commands not to appear (#2977)
1 parent 95b25d3 commit 2f8f1fc

File tree

2 files changed

+20
-11
lines changed

2 files changed

+20
-11
lines changed

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,16 @@ Improvements:
66

77
Bug Fixes:
88
- Compatibility between test and build presets was not enforced. [#2904](https://github.com/microsoft/vscode-cmake-tools/issues/2904)
9-
- Update quote function to fix path separator regression [#2974](https://github.com/microsoft/vscode-cmake-tools/pull/2974)
9+
10+
## 1.13.43
11+
Bug Fixes:
12+
- Fix an issue causing the Add Presets commands not to appear. [PR #2977](https://github.com/microsoft/vscode-cmake-tools/pull/2977)
1013

1114
## 1.13.42
1215
Bug Fixes:
1316
- Fix failed activation when using the `cmake.allowUnsupportedPresetsVersions` setting. [#2968](https://github.com/microsoft/vscode-cmake-tools/issues/2968)
1417
- Verify binary directories only if there are multiple sources. [#2963](https://github.com/microsoft/vscode-cmake-tools/issues/2963)
18+
- Update quote function to fix path separator regression [#2974](https://github.com/microsoft/vscode-cmake-tools/pull/2974)
1519

1620
## 1.13.41
1721
Bug Fixes:

src/projectController.ts

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,13 @@ export class ProjectController implements vscode.Disposable {
7474
if (openEditor) {
7575
for (const project of projects) {
7676
if (util.isFileInsideFolder(openEditor.document, project.folderPath)) {
77-
this.activeProject = project;
77+
this.setActiveProject(project);
7878
break;
7979
}
8080
}
8181
if (!this.activeProject) {
8282
if (util.isFileInsideFolder(openEditor.document, projects[0].workspaceFolder.uri.fsPath)) {
83-
this.activeProject = projects[0];
83+
this.setActiveProject(projects[0]);
8484
}
8585
}
8686
// If active project is found, return.
@@ -89,15 +89,16 @@ export class ProjectController implements vscode.Disposable {
8989
}
9090
} else {
9191
// Set a default active project.
92-
this.activeProject = projects[0];
92+
this.setActiveProject(projects[0]);
9393
return;
9494
}
9595
}
96-
this.activeProject = undefined;
96+
this.setActiveProject(undefined);
9797
}
9898

9999
setActiveProject(project?: CMakeProject): void {
100100
this.activeProject = project;
101+
void this.updateUsePresetsState(this.activeProject);
101102
}
102103

103104
public getActiveCMakeProject(): CMakeProject | undefined {
@@ -397,12 +398,16 @@ export class ProjectController implements vscode.Disposable {
397398
}
398399
}
399400
if (this.activeProject) {
400-
const use: boolean = this.activeProject.useCMakePresets;
401-
await util.setContextValue('useCMakePresets', use);
402-
const statusBar: StatusBar | undefined = getStatusBar();
403-
if (statusBar) {
404-
statusBar.useCMakePresets(use);
405-
}
401+
await this.updateUsePresetsState(this.activeProject);
402+
}
403+
}
404+
405+
private async updateUsePresetsState(project?: CMakeProject): Promise<void> {
406+
const state: boolean = project?.useCMakePresets || false;
407+
await util.setContextValue('useCMakePresets', state);
408+
const statusBar: StatusBar | undefined = getStatusBar();
409+
if (statusBar) {
410+
statusBar.useCMakePresets(state);
406411
}
407412
}
408413

0 commit comments

Comments
 (0)