Skip to content

Commit e107995

Browse files
committed
Auto merge of #12427 - Veykril:configfix, r=Veykril
fix: Fix VSCode config patching incorrectly patching some configs
2 parents c2099fe + 3e25c85 commit e107995

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

editors/code/src/config.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ export async function updateConfig(config: vscode.WorkspaceConfiguration) {
219219
},
220220
];
221221
for (const { val, langVal, target } of valMatrix) {
222-
const pred = (val: unknown) => {
222+
const patch = (val: unknown) => {
223223
// some of the updates we do only append "enable" or "custom"
224224
// that means on the next run we would find these again, but as objects with
225225
// these properties causing us to destroy the config
@@ -229,15 +229,15 @@ export async function updateConfig(config: vscode.WorkspaceConfiguration) {
229229
!(
230230
typeof val === "object" &&
231231
val !== null &&
232-
(val.hasOwnProperty("enable") || val.hasOwnProperty("custom"))
232+
(oldKey === "completion.snippets" || !val.hasOwnProperty("custom"))
233233
)
234234
);
235235
};
236-
if (pred(val)) {
236+
if (patch(val)) {
237237
await config.update(newKey, val, target, false);
238238
await config.update(oldKey, undefined, target, false);
239239
}
240-
if (pred(langVal)) {
240+
if (patch(langVal)) {
241241
await config.update(newKey, langVal, target, true);
242242
await config.update(oldKey, undefined, target, true);
243243
}

0 commit comments

Comments
 (0)