mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 21:35:20 +00:00
Auto merge of #12209 - Veykril:config-fix, r=Veykril
fix: Fix config patching failing when appending suffixes
This commit is contained in:
commit
b350a1bf6f
1 changed files with 25 additions and 7 deletions
|
@ -11,13 +11,16 @@ pub(super) fn patch_json_for_outdated_configs(json: &mut Value) {
|
||||||
($(
|
($(
|
||||||
$($src:ident).+ -> $($dst:ident).+ ;
|
$($src:ident).+ -> $($dst:ident).+ ;
|
||||||
)+) => { $(
|
)+) => { $(
|
||||||
if let Some(it) = copy.pointer(concat!($("/", stringify!($src)),+)).cloned() {
|
match copy.pointer(concat!($("/", stringify!($src)),+)).cloned() {
|
||||||
|
Some(Value::Object(_)) | None => (),
|
||||||
|
Some(it) => {
|
||||||
let mut last = it;
|
let mut last = it;
|
||||||
for segment in [$(stringify!($dst)),+].into_iter().rev() {
|
for segment in [$(stringify!($dst)),+].into_iter().rev() {
|
||||||
last = Value::Object(serde_json::Map::from_iter(std::iter::once((segment.to_string(), last))));
|
last = Value::Object(serde_json::Map::from_iter(std::iter::once((segment.to_string(), last))));
|
||||||
}
|
}
|
||||||
|
|
||||||
merge(json, last);
|
merge(json, last);
|
||||||
|
},
|
||||||
}
|
}
|
||||||
)+ };
|
)+ };
|
||||||
}
|
}
|
||||||
|
@ -36,7 +39,6 @@ pub(super) fn patch_json_for_outdated_configs(json: &mut Value) {
|
||||||
cargo.runBuildScripts -> cargo.runBuildScripts.overrideCommand;
|
cargo.runBuildScripts -> cargo.runBuildScripts.overrideCommand;
|
||||||
cargo.runBuildScriptsCommand -> cargo.runBuildScripts.overrideCommand;
|
cargo.runBuildScriptsCommand -> cargo.runBuildScripts.overrideCommand;
|
||||||
cargo.useRustcWrapperForBuildScripts -> cargo.runBuildScripts.useRustcWrapper;
|
cargo.useRustcWrapperForBuildScripts -> cargo.runBuildScripts.useRustcWrapper;
|
||||||
completion.snippets -> completion.snippets.custom;
|
|
||||||
diagnostics.enableExperimental -> diagnostics.experimental.enable;
|
diagnostics.enableExperimental -> diagnostics.experimental.enable;
|
||||||
experimental.procAttrMacros -> procMacro.attributes.enable;
|
experimental.procAttrMacros -> procMacro.attributes.enable;
|
||||||
highlighting.strings -> semanticHighlighting.strings.enable;
|
highlighting.strings -> semanticHighlighting.strings.enable;
|
||||||
|
@ -66,6 +68,22 @@ pub(super) fn patch_json_for_outdated_configs(json: &mut Value) {
|
||||||
rustfmt.enableRangeFormatting -> rustfmt.rangeFormatting.enable;
|
rustfmt.enableRangeFormatting -> rustfmt.rangeFormatting.enable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// completion.snippets -> completion.snippets.custom;
|
||||||
|
if let Some(Value::Object(obj)) = copy.pointer("/completion/snippets").cloned() {
|
||||||
|
if obj.len() != 1 || obj.get("custom").is_none() {
|
||||||
|
merge(
|
||||||
|
json,
|
||||||
|
json! {{
|
||||||
|
"completion": {
|
||||||
|
"snippets": {
|
||||||
|
"custom": obj
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// callInfo_full -> signatureInfo_detail, signatureInfo_documentation_enable
|
// callInfo_full -> signatureInfo_detail, signatureInfo_documentation_enable
|
||||||
if let Some(Value::Bool(b)) = copy.pointer("/callInfo/full") {
|
if let Some(Value::Bool(b)) = copy.pointer("/callInfo/full") {
|
||||||
let sig_info = match b {
|
let sig_info = match b {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue