Skip to content

Commit

Permalink
Search cmakelists only if user asks to configure (#3276)
Browse files Browse the repository at this point in the history
* Search cmakelists only if user asks to configure

* Add changelog entry

---------

Co-authored-by: Garrett Campbell <[email protected]>
Co-authored-by: snehara99 <[email protected]>
  • Loading branch information
3 people authored Oct 12, 2023
1 parent 95a17bd commit 6d8c3e6
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 22 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Improvements:
- Added script mode and ability to connect to externally launched CMake processes. [PR #3277](https://github.com/microsoft/vscode-cmake-tools/pull/3277)
- Added buttons to the project nodes in the Project Outline View. [PR #3354](https://github.com/microsoft/vscode-cmake-tools/pull/3354) [@vlavati](https://github.com/vlavati)
- `$penv{}` macros are expanded in `include` paths in CMakePresets.json as long as `version` is 7 or higher. [#3310](https://github.com/microsoft/vscode-cmake-tools/issues/3310)
- Disable search and select of CMakeLists.txt, if user chooses not to configure project without CMakeLists.txt in the root. [PR #3276](https://github.com/microsoft/vscode-cmake-tools/pull/3276) [@vlavati](https://github.com/vlavati)

Bug Fixes:
- Fix Unhandled Exception if no args are specified in `cmake.getLaunchTargetFilename` inside an input context of a task. [PR #3348](https://github.com/microsoft/vscode-cmake-tools/issues/3348) [@vlavati](https://github.com/vlavati)
Expand Down
44 changes: 22 additions & 22 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -488,31 +488,31 @@ export class ExtensionManager implements vscode.Disposable {
shouldConfigure = chosen.doConfigure;
}
}
if (project) {
if (!project.hasCMakeLists()) {
if (!project.hasCMakeLists()) {
if (shouldConfigure === true) {
await project.cmakePreConditionProblemHandler(CMakePreconditionProblems.MissingCMakeListsFile, false, this.workspaceConfig);
}
} else {
if (shouldConfigure === true) {
// We've opened a new workspace folder, and the user wants us to
// configure it now.
log.debug(localize('configuring.workspace.on.open', 'Configuring workspace on open {0}', project.folderPath));
await this.configureExtensionInternal(ConfigureTrigger.configureOnOpen, project);
} else {
if (shouldConfigure === true) {
// We've opened a new workspace folder, and the user wants us to
// configure it now.
log.debug(localize('configuring.workspace.on.open', 'Configuring workspace on open {0}', project.folderPath));
await this.configureExtensionInternal(ConfigureTrigger.configureOnOpen, project);
const configureButtonMessage = localize('configure.now.button', 'Configure Now');
let result: string | undefined;
if (silentScanForKitsNeeded) {
// This popup will show up the first time after deciding not to configure, if a version change has been detected
// in the kits definition. This may happen during a CMake Tools extension upgrade.
// The warning is emitted only once because scanForKitsIfNeeded returns true only once after such change,
// being tied to a global state variable.
result = await vscode.window.showWarningMessage(localize('configure.recommended', 'It is recommended to reconfigure after upgrading to a new kits definition.'), configureButtonMessage);
}
if (result === configureButtonMessage) {
await this.configureExtensionInternal(ConfigureTrigger.buttonNewKitsDefinition, project);
} else {
const configureButtonMessage = localize('configure.now.button', 'Configure Now');
let result: string | undefined;
if (silentScanForKitsNeeded) {
// This popup will show up the first time after deciding not to configure, if a version change has been detected
// in the kits definition. This may happen during a CMake Tools extension upgrade.
// The warning is emitted only once because scanForKitsIfNeeded returns true only once after such change,
// being tied to a global state variable.
result = await vscode.window.showWarningMessage(localize('configure.recommended', 'It is recommended to reconfigure after upgrading to a new kits definition.'), configureButtonMessage);
}
if (result === configureButtonMessage) {
await this.configureExtensionInternal(ConfigureTrigger.buttonNewKitsDefinition, project);
} else {
log.debug(localize('using.cache.to.configure.workspace.on.open', 'Attempting to use cache to configure workspace {0}', rootFolder.uri.toString()));
await this.configureExtensionInternal(ConfigureTrigger.configureWithCache, project);
}
log.debug(localize('using.cache.to.configure.workspace.on.open', 'Attempting to use cache to configure workspace {0}', rootFolder.uri.toString()));
await this.configureExtensionInternal(ConfigureTrigger.configureWithCache, project);
}
}
}
Expand Down

0 comments on commit 6d8c3e6

Please sign in to comment.