Skip to content

Commit

Permalink
ensure we take deep copy of presets for presetsPlusIncluded (#3939)
Browse files Browse the repository at this point in the history
  • Loading branch information
gcampbell-msft authored Jul 26, 2024
1 parent 2be0df4 commit 4dc3817
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3702,6 +3702,7 @@
"@types/chai-string": "^1.4.2",
"@types/js-yaml": "^4.0.0",
"@types/json5": "~0.0.30",
"@types/lodash": "4.14.202",
"@types/mocha": "^8.2.2",
"@types/node": "~14.14.28",
"@types/rimraf": "^3.0.0",
Expand Down Expand Up @@ -3768,7 +3769,8 @@
"vscode-tas-client": "^0.1.45",
"which": "~2.0.2",
"xml2js": "^0.4.23",
"uuid": "~8.3.2"
"uuid": "~8.3.2",
"lodash": "^4.17.21"
},
"resolutions": {
"ansi-regex": "^5.0.1",
Expand Down
4 changes: 3 additions & 1 deletion src/presetsController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import * as chokidar from 'chokidar';
import * as path from 'path';
import * as vscode from 'vscode';
import * as nls from 'vscode-nls';
import * as lodash from "lodash";

import { CMakeProject, ConfigureTrigger, ConfigureType } from '@cmt/cmakeProject';
import * as logging from '@cmt/logging';
Expand Down Expand Up @@ -187,8 +188,9 @@ export class PresetsController {
this.populatePrivatePresetsFields(presetsFile, file);
await this.mergeIncludeFiles(presetsFile, presetsFile, file, referencedFiles);

const copyOfPresetsFile = lodash.cloneDeep(presetsFile);
// add the include files to the original presets file
setPresetsPlusIncluded(this.folderPath, {...presetsFile});
setPresetsPlusIncluded(this.folderPath, copyOfPresetsFile);

// set the pre-expanded version so we can call expandPresetsFile on it
setExpandedPresets(this.folderPath, presetsFile);
Expand Down
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,11 @@
resolved "https://registry.npmjs.org/@types/json5/-/json5-0.0.30.tgz"
integrity sha512-sqm9g7mHlPY/43fcSNrCYfOeX9zkTTK+euO5E6+CVijSMm5tTjkVdwdqRkY3ljjIAf8679vps5jKUoJBCLsMDA==

"@types/[email protected]":
version "4.14.202"
resolved "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.202.tgz#f09dbd2fb082d507178b2f2a5c7e74bd72ff98f8"
integrity sha512-OvlIYQK9tNneDlS0VN54LLd5uiPCBOp7gS5Z0f1mjoJYBrtStzgmJBxONW3U6OZqdtNzZPmn9BS/7WI7BFFcFQ==

"@types/minimatch@*", "@types/minimatch@^3.0.3":
version "3.0.5"
resolved "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.5.tgz"
Expand Down

0 comments on commit 4dc3817

Please sign in to comment.