Skip to content

Commit

Permalink
Merge branch 'main' into dev/gcampbell/SpawnShellFix
Browse files Browse the repository at this point in the history
  • Loading branch information
gcampbell-msft authored Oct 10, 2024
2 parents a2b7beb + 1818a7e commit 3185833
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 21 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Improvements:

Bug Fixes:

- Fix our setting of `isUserPreset` for presets, only set it to `true` if it's defined in a user presets file. [#4059](https://github.com/microsoft/vscode-cmake-tools/issues/4059)
- Fix issue where duplicate presets are being listed in dropdown. [#4104](https://github.com/microsoft/vscode-cmake-tools/issues/4104)

## 1.19.52
Expand Down
41 changes: 20 additions & 21 deletions src/preset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -467,24 +467,39 @@ export function setPresetsPlusIncluded(folder: string, presets: PresetsFile | un
presetsPlusIncluded.set(folder, presets);
}

export function setUserPresetsPlusIncluded(folder: string, presets: PresetsFile | undefined) {
export function setUserPresetsHelper(presets: PresetsFile | undefined) {
if (presets) {
// for each condition of `isUserPreset`, if we don't find file.path, then we default to true like before.
if (presets.configurePresets) {
for (const configPreset of presets.configurePresets) {
configPreset.isUserPreset = true;
configPreset.isUserPreset = configPreset.__file?.__path?.endsWith("CMakeUserPresets.json") ?? true;
}
}
if (presets.buildPresets) {
for (const buildPreset of presets.buildPresets) {
buildPreset.isUserPreset = true;
buildPreset.isUserPreset = buildPreset.__file?.__path?.endsWith("CMakeUserPresets.json") ?? true;
}
}
if (presets.testPresets) {
for (const testPreset of presets.testPresets) {
testPreset.isUserPreset = true;
testPreset.isUserPreset = testPreset.__file?.__path?.endsWith("CMakeUserPresets.json") ?? true;
}
}
if (presets.packagePresets) {
for (const packagePreset of presets.packagePresets) {
packagePreset.isUserPreset = packagePreset.__file?.__path?.endsWith("CMakeUserPresets.json") ?? true;
}
}
if (presets.workflowPresets) {
for (const workflowPreset of presets.workflowPresets) {
workflowPreset.isUserPreset = workflowPreset.__file?.__path?.endsWith("CMakeUserPresets.json") ?? true;
}
}
}
}

export function setUserPresetsPlusIncluded(folder: string, presets: PresetsFile | undefined) {
setUserPresetsHelper(presets);
userPresetsPlusIncluded.set(folder, presets);
}

Expand Down Expand Up @@ -544,23 +559,7 @@ function updateCachedExpandedPresethelper(cache: PresetsFile | undefined, preset
}

export function setExpandedUserPresetsFile(folder: string, presets: PresetsFile | undefined) {
if (presets) {
if (presets.configurePresets) {
for (const configPreset of presets.configurePresets) {
configPreset.isUserPreset = true;
}
}
if (presets.buildPresets) {
for (const buildPreset of presets.buildPresets) {
buildPreset.isUserPreset = true;
}
}
if (presets.testPresets) {
for (const testPreset of presets.testPresets) {
testPreset.isUserPreset = true;
}
}
}
setUserPresetsHelper(presets);
expandedUserPresets.set(folder, presets);
}

Expand Down

0 comments on commit 3185833

Please sign in to comment.