Skip to content
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: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
25 changes: 15 additions & 10 deletions src/projectController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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 {
Expand Down Expand Up @@ -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<void> {
const state: boolean = project?.useCMakePresets || false;
await util.setContextValue('useCMakePresets', state);
const statusBar: StatusBar | undefined = getStatusBar();
if (statusBar) {
statusBar.useCMakePresets(state);
}
}

Expand Down