Skip to content

Commit

Permalink
fix(vscode): Configuration default values use cloneDeep
Browse files Browse the repository at this point in the history
  • Loading branch information
tomgao365 committed Jun 11, 2024
1 parent 6d42f94 commit 281ce50
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 2 deletions.
6 changes: 5 additions & 1 deletion packages/vscode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,11 @@
"prepublishOnly": "pnpm build"
},
"dependencies": {
"@tomjs/node": "^2.1.0"
"@tomjs/node": "^2.1.0",
"lodash.clonedeep": "^4.5.0"
},
"devDependencies": {
"@types/lodash.clonedeep": "^4.5.9"
},
"peerDependencies": {
"@types/vscode": "^1.56.0"
Expand Down
3 changes: 2 additions & 1 deletion packages/vscode/src/configuration.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import cloneDeep from 'lodash.clonedeep';
import { ConfigurationTarget, workspace } from 'vscode';

export class Configuration<T> {
Expand Down Expand Up @@ -34,7 +35,7 @@ export class Configuration<T> {
Object.keys(cfg)
.filter(key => typeof cfg[key] !== 'function')
.forEach(key => {
values[key] = cfg.get(key, this._defaultValues[key]);
values[key] = cfg.get(key) ?? cloneDeep(this._defaultValues[key]);
});
return values;
}
Expand Down
24 changes: 24 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 281ce50

Please sign in to comment.