microsoft / microsoft/vscode-cmake-tools

cmake.defaultVariants doesn't override default buildType, but appends

Open
#3,351 2 comments 5 reactions 0 assignees View on GitHub
bug documentation Feature: settings Feature: variants
Dominant language
TypeScript
Stars
1.7k
Forks
546
Avg merge
2d 16h
Merged PRs (30d)
32

Description

### Brief Issue Summary

When using the `cmake.defaultVariants` setting, the values used in the `buildType` entry are appended to the defaults instead of replacing them.

For example the following setting value:

```json
"cmake.defaultVariants": {
"buildType": {
"default": "beepbeep",
"description": "The build type.",
"choices": {
"beepbeep": {
"short": "Beep Beep",
"long": "This build goes beep beep",
"buildType": "Beep"
},
}
}
}
```

Gives the following list of variants:

![image](https://github.com/microsoft/vscode-cmake-tools/assets/126668146/29a4269a-865c-413c-b2e0-16e4e938b5c3)

This happens both with simple folder workspaces, and `.code-workspace` workspaces.

### CMake Tools Diagnostics

_No response_

### Debug Log

```shell
There is no additional debug info printed beyond "[variant] Loaded new set of variants"
```

### Additional Information

_No response_

Contributor guide

Open the contributing guide

Research direction

Start by tracing how the cmake.defaultVariants setting is loaded and how the buildType entry is merged when the variant list is produced; the debug log identifies this as the "[variant] Loaded new set of variants" path. Verify the behavior for both folder and .code-workspace workspaces, and consider the issue done when custom buildType values replace rather than append to the defaults.

Written by the indexing model from the issue text.

Assessment

Tech stack
cmake, typescript
Domain
build-system, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.