Skip to content

Commit

Permalink
Fix3355 - use default configuration with no build type (#3363)
Browse files Browse the repository at this point in the history
When configuring this extension with a CMakePresets.json, with a
CMakeCache.txt that doesn't define a CMAKE_BUILD_TYPE, the intelliSense
configuration was not passed to vscode-cpptools. However, this is a
valid CMake configuration which should use the toolchain's default
configuration. Building through the extension did work.

The codeModelContent configuration was rejected because it's name (""),
didn't match activeBuildTypeVariant which was null.

This patch accepts an unnamed configurations in the case where no active
build type variant is set.

The CHANGELOG was updated.
  • Loading branch information
deribaucourt authored Oct 4, 2023
1 parent fd5a15a commit 27412d3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Improvements:

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)
- Fix incorrect IntelliSense configuration with default/empty `CMAKE_BUILD_TYPE` using CMakePresets. [PR #3363](https://github.com/microsoft/vscode-cmake-tools/pull/3363) [@deribaucourt](https://github.com/deribaucourt)

## 1.15
Features:
Expand Down
2 changes: 1 addition & 1 deletion src/cpptools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,7 @@ export class CppConfigurationProvider implements cpptools.CustomConfigurationPro
}
for (const config of opts.codeModelContent.configurations) {
// Update only the active build type variant.
if (config.name === opts.activeBuildTypeVariant) {
if (config.name === opts.activeBuildTypeVariant || (!opts.activeBuildTypeVariant && config.name === "")) {
for (const project of config.projects) {
for (const target of project.targets) {
// Now some shenanigans since header files don't have config data:
Expand Down

0 comments on commit 27412d3

Please sign in to comment.