diff options
| author | Lukas Wirth <lukastw97@gmail.com> | 2022-05-12 17:55:25 +0200 |
|---|---|---|
| committer | Lukas Wirth <lukastw97@gmail.com> | 2022-05-12 17:55:25 +0200 |
| commit | 252ffbf77a7838313d5ef5c2da329a15d7f78f34 (patch) | |
| tree | 4e95b0a17ab23c235fb347cfb749becee6437af8 | |
| parent | 135164f54710aaaa1514187b27804d6ab1b31370 (diff) | |
| download | rust-252ffbf77a7838313d5ef5c2da329a15d7f78f34.tar.gz rust-252ffbf77a7838313d5ef5c2da329a15d7f78f34.zip | |
fix: Fix old config patching overwriting callable snippet config unconditionally
| -rw-r--r-- | crates/rust-analyzer/src/config.rs | 1 | ||||
| -rw-r--r-- | crates/rust-analyzer/src/config/patch_old_style.rs | 3 |
2 files changed, 3 insertions, 1 deletions
diff --git a/crates/rust-analyzer/src/config.rs b/crates/rust-analyzer/src/config.rs index f2fade9d487..58b73eb72fd 100644 --- a/crates/rust-analyzer/src/config.rs +++ b/crates/rust-analyzer/src/config.rs @@ -595,6 +595,7 @@ impl Config { .collect(); patch_old_style::patch_json_for_outdated_configs(&mut json); self.data = ConfigData::from_json(json, &mut errors); + tracing::debug!("deserialized config data: {:#?}", self.data); self.snippets.clear(); for (name, def) in self.data.completion_snippets_custom.iter() { if def.prefix.is_empty() && def.postfix.is_empty() { diff --git a/crates/rust-analyzer/src/config/patch_old_style.rs b/crates/rust-analyzer/src/config/patch_old_style.rs index 04b14f73db0..05c2bb537f8 100644 --- a/crates/rust-analyzer/src/config/patch_old_style.rs +++ b/crates/rust-analyzer/src/config/patch_old_style.rs @@ -117,7 +117,8 @@ pub(super) fn patch_json_for_outdated_configs(json: &mut Value) { ) { (Some(Value::Bool(true)), Some(Value::Bool(true))) => json!("fill_arguments"), (Some(Value::Bool(true)), _) => json!("add_parentheses"), - (_, _) => json!(null), + (Some(Value::Bool(false)), Some(Value::Bool(false))) => json!("add_parentheses"), + (_, _) => return, }; merge(json, json!({ "completion": { "callable": {"snippets": res }} })); } |
