From 2dac33fe70088bc67594e8628d03a5eca5b4dd52 Mon Sep 17 00:00:00 2001 From: VlaVaTi Date: Wed, 2 Aug 2023 13:16:16 +0300 Subject: [PATCH 1/2] Search cmakelists only if user asks to configure --- src/extension.ts | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/src/extension.ts b/src/extension.ts index da9602b51..f3aee531c 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -487,31 +487,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); } } } From f09fbd1c42c56604c2e33832f1851d8ddaca05c5 Mon Sep 17 00:00:00 2001 From: VlaVaTi Date: Thu, 12 Oct 2023 22:57:37 +0300 Subject: [PATCH 2/2] Add changelog entry --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3abbd5bca..59f0fbea1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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)