Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Search cmakelists only if user asks to configure #3276

Merged
merged 5 commits into from
Oct 12, 2023
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
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()) {
gcampbell-msft marked this conversation as resolved.
Show resolved Hide resolved
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