mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-11-15 01:17:27 +00:00
fix: Fix VSCode config patching incorrectly patching some configs
This commit is contained in:
parent
0327df224b
commit
3e25c853cf
1 changed files with 4 additions and 4 deletions
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue