about summary refs log tree commit diff
diff options
context:
space:
mode:
authorLukas Wirth <lukastw97@gmail.com>2022-05-31 13:27:34 +0200
committerLukas Wirth <lukastw97@gmail.com>2022-05-31 13:38:48 +0200
commit3e25c853cf12b2f24972d859feb010d01b1f0e98 (patch)
tree5657fc7b76f6c3b7648bae2523f3bd17f0fe70bb
parent0327df224bf67ef2c3ceb5a69729cf36a6a96ba1 (diff)
downloadrust-3e25c853cf12b2f24972d859feb010d01b1f0e98.tar.gz
rust-3e25c853cf12b2f24972d859feb010d01b1f0e98.zip
fix: Fix VSCode config patching incorrectly patching some configs
-rw-r--r--editors/code/src/config.ts8
1 files changed, 4 insertions, 4 deletions
diff --git a/editors/code/src/config.ts b/editors/code/src/config.ts
index d07e47c8de9..fd9665b6145 100644
--- a/editors/code/src/config.ts
+++ b/editors/code/src/config.ts
@@ -219,7 +219,7 @@ export async function updateConfig(config: vscode.WorkspaceConfiguration) {
                 },
             ];
             for (const { val, langVal, target } of valMatrix) {
-                const pred = (val: unknown) => {
+                const patch = (val: unknown) => {
                     // some of the updates we do only append "enable" or "custom"
                     // that means on the next run we would find these again, but as objects with
                     // these properties causing us to destroy the config
@@ -229,15 +229,15 @@ export async function updateConfig(config: vscode.WorkspaceConfiguration) {
                         !(
                             typeof val === "object" &&
                             val !== null &&
-                            (val.hasOwnProperty("enable") || val.hasOwnProperty("custom"))
+                            (oldKey === "completion.snippets" || !val.hasOwnProperty("custom"))
                         )
                     );
                 };
-                if (pred(val)) {
+                if (patch(val)) {
                     await config.update(newKey, val, target, false);
                     await config.update(oldKey, undefined, target, false);
                 }
-                if (pred(langVal)) {
+                if (patch(langVal)) {
                     await config.update(newKey, langVal, target, true);
                     await config.update(oldKey, undefined, target, true);
                 }