Skip to content

Commit bf93ad9

Browse files
Fix extension not switching to preset mode after Quick Start generates CMakePresets.json (#4712)
* Initial plan * Fix extension not switching to preset mode after Quick Start generates CMakePresets.json Subscribe to onUseCMakePresetsChanged in ProjectController.setupProjectSubscriptions() so that when doUseCMakePresetsChange() detects a new CMakePresets.json (e.g. after Quick Start), the VS Code context, status bar, and project status are updated to reflect preset mode. Fixes #4569 Co-authored-by: hanniavalera <[email protected]> --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: hanniavalera <[email protected]>
1 parent 0fdfcea commit bf93ad9

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Improvements:
1010
- Add MSVC linker error problem matching to the Problems pane. [#4675](https://github.com/microsoft/vscode-cmake-tools/pull/4675) [@bradphelan](https://github.com/bradphelan)
1111

1212
Bug Fixes:
13+
- Fix extension not switching to preset mode after "CMake: Quick Start" generates a CMakePresets.json, causing variant selection to have no effect. [#4569](https://github.com/microsoft/vscode-cmake-tools/issues/4569)
1314
- Fix spurious preset reloads triggered by unrelated file system events such as builds, git commits, and `cmake.copyCompileCommands`. Migrated file watching from chokidar to VS Code's built-in `FileSystemWatcher` API, which also resolves high CPU usage on Apple M1. [#4703](https://github.com/microsoft/vscode-cmake-tools/issues/4703) [#2967](https://github.com/microsoft/vscode-cmake-tools/issues/2967)
1415
- Clarify that semicolons in `cmake.configureSettings` string values are escaped, and array notation should be used for CMake lists. [#4585](https://github.com/microsoft/vscode-cmake-tools/issues/4585)
1516
- Fix "CMake: Quick Start" command failing silently when no folder is open. Now shows an error message with an option to open a folder. [#4504](https://github.com/microsoft/vscode-cmake-tools/issues/4504)

src/projectController.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ export class ProjectController implements vscode.Disposable {
6060
private activePackagePresetSub: vscode.Disposable = new DummyDisposable();
6161
private activeWorkflowPresetSub: vscode.Disposable = new DummyDisposable();
6262
private isBusySub = new DummyDisposable();
63+
private useCMakePresetsChangedSub: vscode.Disposable = new DummyDisposable();
6364
private projectSubscriptions: vscode.Disposable[] = [
6465
this.targetNameSub,
6566
this.variantNameSub,
@@ -70,7 +71,8 @@ export class ProjectController implements vscode.Disposable {
7071
this.activeTestPresetSub,
7172
this.activePackagePresetSub,
7273
this.activeWorkflowPresetSub,
73-
this.isBusySub
74+
this.isBusySub,
75+
this.useCMakePresetsChangedSub
7476
];
7577

7678
get onBeforeAcknowledgeFolder() {
@@ -148,6 +150,7 @@ export class ProjectController implements vscode.Disposable {
148150
this.activePackagePresetSub = new DummyDisposable();
149151
this.activeWorkflowPresetSub = new DummyDisposable();
150152
this.isBusySub = new DummyDisposable();
153+
this.useCMakePresetsChangedSub = new DummyDisposable();
151154
} else {
152155
this.targetNameSub = project.onTargetNameChanged(FireNow, () => void this.projectStatus.refresh());
153156
this.variantNameSub = project.onActiveVariantNameChanged(FireNow, () => void this.projectStatus.refresh());
@@ -159,6 +162,7 @@ export class ProjectController implements vscode.Disposable {
159162
this.activePackagePresetSub = project.onActivePackagePresetChanged(FireNow, () => void this.projectStatus.refresh());
160163
this.activeWorkflowPresetSub = project.onActiveWorkflowPresetChanged(FireNow, () => void this.projectStatus.refresh());
161164
this.isBusySub = project.onIsBusyChanged(FireNow, (isBusy) => void this.projectStatus.setIsBusy(isBusy));
165+
this.useCMakePresetsChangedSub = project.onUseCMakePresetsChanged(() => void this.updateUsePresetsState(project));
162166
await setContextAndStore(ext.hideBuildCommandKey, project.hideBuildButton);
163167
await setContextAndStore(ext.hideDebugCommandKey, project.hideDebugButton);
164168
await setContextAndStore(ext.hideLaunchCommandKey, project.hideLaunchButton);

0 commit comments

Comments
 (0)