mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-29 06:23:25 +00:00
Auto merge of #12228 - Veykril:configfix, r=Veykril
fix: Fix old config patching overwriting callable snippet config unconditionally
This commit is contained in:
commit
1491013417
2 changed files with 3 additions and 1 deletions
|
@ -595,6 +595,7 @@ impl Config {
|
||||||
.collect();
|
.collect();
|
||||||
patch_old_style::patch_json_for_outdated_configs(&mut json);
|
patch_old_style::patch_json_for_outdated_configs(&mut json);
|
||||||
self.data = ConfigData::from_json(json, &mut errors);
|
self.data = ConfigData::from_json(json, &mut errors);
|
||||||
|
tracing::debug!("deserialized config data: {:#?}", self.data);
|
||||||
self.snippets.clear();
|
self.snippets.clear();
|
||||||
for (name, def) in self.data.completion_snippets_custom.iter() {
|
for (name, def) in self.data.completion_snippets_custom.iter() {
|
||||||
if def.prefix.is_empty() && def.postfix.is_empty() {
|
if def.prefix.is_empty() && def.postfix.is_empty() {
|
||||||
|
|
|
@ -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)), Some(Value::Bool(true))) => json!("fill_arguments"),
|
||||||
(Some(Value::Bool(true)), _) => json!("add_parentheses"),
|
(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 }} }));
|
merge(json, json!({ "completion": { "callable": {"snippets": res }} }));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue