microsoft / microsoft/vscode-cmake-tools
[Bug] CMake Tools shows unsolicited quick picks on startup (`configureOnOpen`), cancelling the user's active quick pick
- Dominant language
- TypeScript
- Stars
- 1.7k
- Forks
- 546
- Avg merge
- 2d 16h
- Merged PRs (30d)
- 32
Description
### Brief Issue Summary
This bug report was generated by Copilot (with Claude Opus 4.8 using VS Code) referencing this repo's source. I could potentially look into using Copilot to fix it later.
## Environment
- CMake Tools version: 1.13.0
- VS Code: 1.88+
- OS: Linux (reproduces on all platforms)
## Description
When a workspace is opened, CMake Tools automatically shows quick picks during its activation / `postWorkspaceOpen` flow, without any user gesture. VS Code's quick input is a single shared UI widget — calling `showQuickPick` cancels whatever quick pick is currently on screen (the older controller is hidden via `oldController?.didHide()` in `QuickInputController.show()`). As a result, if I invoke my own command that opens a quick pick right after opening a folder, CMake Tools' startup quick pick(s) pop up and dismiss mine. In a multi-root workspace this can happen several times in a row, making it nearly impossible to use my own quick pick during the first several seconds after startup (e.g. many basic commands in a multi-root workspace invoke a quick pick to select the workspace to use, such as opening a terminal).
## Root cause / code paths
The problem is that these prompts are triggered *automatically on open* rather than in response to a user action:
1. **Kit / configure-preset selection on configure-on-open.**
`postWorkspaceOpen()` → `configureExtensionInternal(ConfigureTrigger.configureOnOpen, ...)` → `ensureActiveConfigurePresetOrKit()` calls `selectConfigurePreset()` or `selectKit()` when no preset/kit is set. These display a quick pick during startup.
- extension.ts `postWorkspaceOpen` (~L780), `ensureActiveConfigurePresetOrKit` (~L582), `selectConfigurePreset` (~L594), `selectKit` (~L614)
2. **"Select CMakeLists.txt" quick pick.**
`postWorkspaceOpen()` → `cmakePreConditionProblemHandler(CMakePreconditionProblems.MissingCMakeListsFile, ...)` → `promptToSelectCMakeListsFile()` which calls `vscode.window.showQuickPick(...)` when the root has no CMakeLists.txt but one exists in a subdirectory.
- cmakeProject.ts `cmakePreConditionProblemHandler` (~L971), `promptToSelectCMakeListsFile` (~L1039), `showQuickPick` (~L1066)
Both fire automatically as part of activation, so they compete with (and cancel) user-initiated quick picks.
## Steps to reproduce
1. Open a CMake workspace where no kit/configure-preset is selected yet (or the root has no CMakeLists.txt but a subfolder does), with `cmake.configureOnOpen` enabled (default).
2. Immediately after the window opens, invoke a command of your own that opens a quick pick.
3. Observe CMake Tools' startup quick pick appear and cancel your quick pick. In a multi-root workspace, repeat per folder.
## Expected behavior
CMake Tools should not steal an already-open quick pick during startup. Options:
- Defer/queue the kit/preset/CMakeLists selection prompts so they don't display while another quick pick is active (e.g., wait until the quick input is idle, or surface them as a non-modal notification / status-bar affordance the user opts into).
- Only prompt in response to an explicit user action, and otherwise surface the "needs configuration" state passively (status bar / notification), as is already done for the kits-definition-change warning.
## Actual behavior
The startup quick picks appear unsolicited and cancel the user's active quick pick, sometimes multiple times in a multi-root workspace.
## Additional context
This is aggravated by VS Code's quick input being a "last caller wins" singleton with no queuing, so any extension that opens a quick pick during activation will interrupt the user. CMake Tools is well-positioned to fix its side by not auto-opening these prompts, or by gating them until the quick input is free.
### CMake Tools Diagnostics
```shell
...
```
### Debug Log
```shell
...
```
### Additional Information
_No response_
Contributor guide
Research direction
Trace postWorkspaceOpen in extension.ts through configureExtensionInternal, ensureActiveConfigurePresetOrKit, selectConfigurePreset, and selectKit, then inspect cmakePreConditionProblemHandler and promptToSelectCMakeListsFile in cmakeProject.ts. Reproduce the startup quick-pick cancellation in a single- and multi-root workspace. Done means startup prompts no longer interrupt an existing user quick pick, with the chosen deferral or passive-notification behavior covered by the relevant tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cmake, typescript
- Domain
- developer-experience, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100