mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-11 20:58:54 +00:00
Remove deprecation support in config
This commit is contained in:
parent
c7c2eb8b08
commit
43098d99ae
3 changed files with 13 additions and 50 deletions
|
@ -142,9 +142,10 @@ config_data! {
|
||||||
highlighting_strings: bool = "true",
|
highlighting_strings: bool = "true",
|
||||||
|
|
||||||
/// Whether to show documentation on hover.
|
/// Whether to show documentation on hover.
|
||||||
hover_documentation: bool = "true",
|
hover_documentation: bool = "true",
|
||||||
/// Use markdown syntax for links in hover.
|
/// Use markdown syntax for links in hover.
|
||||||
hover_linksInHover: bool = "true",
|
hover_linksInHover |
|
||||||
|
hoverActions_linksInHover: bool = "true",
|
||||||
|
|
||||||
/// Whether to show `Debug` action. Only applies when
|
/// Whether to show `Debug` action. Only applies when
|
||||||
/// `#rust-analyzer.hoverActions.enable#` is set.
|
/// `#rust-analyzer.hoverActions.enable#` is set.
|
||||||
|
@ -163,9 +164,6 @@ config_data! {
|
||||||
/// Whether to show `Run` action. Only applies when
|
/// Whether to show `Run` action. Only applies when
|
||||||
/// `#rust-analyzer.hoverActions.enable#` is set.
|
/// `#rust-analyzer.hoverActions.enable#` is set.
|
||||||
hoverActions_run: bool = "true",
|
hoverActions_run: bool = "true",
|
||||||
#[deprecated = "Use hover.linksInHover instead"]
|
|
||||||
/// Use markdown syntax for links in hover.
|
|
||||||
hoverActions_linksInHover: bool = "false",
|
|
||||||
|
|
||||||
/// Whether to show inlay type hints for method chains.
|
/// Whether to show inlay type hints for method chains.
|
||||||
inlayHints_chainingHints: bool = "true",
|
inlayHints_chainingHints: bool = "true",
|
||||||
|
@ -732,7 +730,7 @@ impl Config {
|
||||||
run: self.data.hoverActions_enable && self.data.hoverActions_run,
|
run: self.data.hoverActions_enable && self.data.hoverActions_run,
|
||||||
debug: self.data.hoverActions_enable && self.data.hoverActions_debug,
|
debug: self.data.hoverActions_enable && self.data.hoverActions_debug,
|
||||||
goto_type_def: self.data.hoverActions_enable && self.data.hoverActions_gotoTypeDef,
|
goto_type_def: self.data.hoverActions_enable && self.data.hoverActions_gotoTypeDef,
|
||||||
links_in_hover: self.data.hoverActions_linksInHover || self.data.hover_linksInHover,
|
links_in_hover: self.data.hover_linksInHover,
|
||||||
markdown: try_or!(
|
markdown: try_or!(
|
||||||
self.caps
|
self.caps
|
||||||
.text_document
|
.text_document
|
||||||
|
@ -829,7 +827,6 @@ enum WorskpaceSymbolSearchKindDef {
|
||||||
macro_rules! _config_data {
|
macro_rules! _config_data {
|
||||||
(struct $name:ident {
|
(struct $name:ident {
|
||||||
$(
|
$(
|
||||||
$(#[deprecated=$deprecation_msg:literal])?
|
|
||||||
$(#[doc=$doc:literal])*
|
$(#[doc=$doc:literal])*
|
||||||
$field:ident $(| $alias:ident)*: $ty:ty = $default:expr,
|
$field:ident $(| $alias:ident)*: $ty:ty = $default:expr,
|
||||||
)*
|
)*
|
||||||
|
@ -854,9 +851,8 @@ macro_rules! _config_data {
|
||||||
$({
|
$({
|
||||||
let field = stringify!($field);
|
let field = stringify!($field);
|
||||||
let ty = stringify!($ty);
|
let ty = stringify!($ty);
|
||||||
let deprecation_msg = None $( .or(Some($deprecation_msg)) )?;
|
|
||||||
|
|
||||||
(field, ty, &[$($doc),*], $default, deprecation_msg)
|
(field, ty, &[$($doc),*], $default)
|
||||||
},)*
|
},)*
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
|
@ -867,9 +863,8 @@ macro_rules! _config_data {
|
||||||
$({
|
$({
|
||||||
let field = stringify!($field);
|
let field = stringify!($field);
|
||||||
let ty = stringify!($ty);
|
let ty = stringify!($ty);
|
||||||
let deprecation_msg = None $( .or(Some($deprecation_msg)) )?;
|
|
||||||
|
|
||||||
(field, ty, &[$($doc),*], $default, deprecation_msg)
|
(field, ty, &[$($doc),*], $default)
|
||||||
},)*
|
},)*
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
|
@ -899,9 +894,7 @@ fn get_field<T: DeserializeOwned>(
|
||||||
.unwrap_or(default)
|
.unwrap_or(default)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn schema(
|
fn schema(fields: &[(&'static str, &'static str, &[&str], &str)]) -> serde_json::Value {
|
||||||
fields: &[(&'static str, &'static str, &[&str], &str, Option<&str>)],
|
|
||||||
) -> serde_json::Value {
|
|
||||||
for ((f1, ..), (f2, ..)) in fields.iter().zip(&fields[1..]) {
|
for ((f1, ..), (f2, ..)) in fields.iter().zip(&fields[1..]) {
|
||||||
fn key(f: &str) -> &str {
|
fn key(f: &str) -> &str {
|
||||||
f.splitn(2, '_').next().unwrap()
|
f.splitn(2, '_').next().unwrap()
|
||||||
|
@ -911,23 +904,17 @@ fn schema(
|
||||||
|
|
||||||
let map = fields
|
let map = fields
|
||||||
.iter()
|
.iter()
|
||||||
.map(|(field, ty, doc, default, deprecation_msg)| {
|
.map(|(field, ty, doc, default)| {
|
||||||
let name = field.replace("_", ".");
|
let name = field.replace("_", ".");
|
||||||
let name = format!("rust-analyzer.{}", name);
|
let name = format!("rust-analyzer.{}", name);
|
||||||
let props = field_props(field, ty, doc, default, deprecation_msg.as_deref());
|
let props = field_props(field, ty, doc, default);
|
||||||
(name, props)
|
(name, props)
|
||||||
})
|
})
|
||||||
.collect::<serde_json::Map<_, _>>();
|
.collect::<serde_json::Map<_, _>>();
|
||||||
map.into()
|
map.into()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn field_props(
|
fn field_props(field: &str, ty: &str, doc: &[&str], default: &str) -> serde_json::Value {
|
||||||
field: &str,
|
|
||||||
ty: &str,
|
|
||||||
doc: &[&str],
|
|
||||||
default: &str,
|
|
||||||
deprecation_msg: Option<&str>,
|
|
||||||
) -> serde_json::Value {
|
|
||||||
let doc = doc_comment_to_string(doc);
|
let doc = doc_comment_to_string(doc);
|
||||||
let doc = doc.trim_end_matches('\n');
|
let doc = doc.trim_end_matches('\n');
|
||||||
assert!(
|
assert!(
|
||||||
|
@ -946,9 +933,6 @@ fn field_props(
|
||||||
}
|
}
|
||||||
set!("markdownDescription": doc);
|
set!("markdownDescription": doc);
|
||||||
set!("default": default);
|
set!("default": default);
|
||||||
if let Some(deprecation_msg) = deprecation_msg {
|
|
||||||
set!("deprecationMessage": deprecation_msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
match ty {
|
match ty {
|
||||||
"bool" => set!("type": "boolean"),
|
"bool" => set!("type": "boolean"),
|
||||||
|
@ -1045,23 +1029,13 @@ fn field_props(
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
fn manual(fields: &[(&'static str, &'static str, &[&str], &str, Option<&str>)]) -> String {
|
fn manual(fields: &[(&'static str, &'static str, &[&str], &str)]) -> String {
|
||||||
fields
|
fields
|
||||||
.iter()
|
.iter()
|
||||||
.map(|(field, _ty, doc, default, deprecation_msg)| {
|
.map(|(field, _ty, doc, default)| {
|
||||||
let name = format!("rust-analyzer.{}", field.replace("_", "."));
|
let name = format!("rust-analyzer.{}", field.replace("_", "."));
|
||||||
let doc = doc_comment_to_string(*doc);
|
let doc = doc_comment_to_string(*doc);
|
||||||
match deprecation_msg {
|
format!("[[{}]]{} (default: `{}`)::\n+\n--\n{}--\n", name, name, default, doc)
|
||||||
Some(deprecation_msg) => {
|
|
||||||
format!(
|
|
||||||
"[[{}]]{} (deprecated: `{}`)::\n+\n--\n{}--\n",
|
|
||||||
name, name, deprecation_msg, doc
|
|
||||||
)
|
|
||||||
}
|
|
||||||
None => {
|
|
||||||
format!("[[{}]]{} (default: `{}`)::\n+\n--\n{}--\n", name, name, default, doc)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
.collect::<String>()
|
.collect::<String>()
|
||||||
}
|
}
|
||||||
|
|
|
@ -250,11 +250,6 @@ Whether to show `References` action. Only applies when
|
||||||
Whether to show `Run` action. Only applies when
|
Whether to show `Run` action. Only applies when
|
||||||
`#rust-analyzer.hoverActions.enable#` is set.
|
`#rust-analyzer.hoverActions.enable#` is set.
|
||||||
--
|
--
|
||||||
[[rust-analyzer.hoverActions.linksInHover]]rust-analyzer.hoverActions.linksInHover (deprecated: `Use hover.linksInHover instead`)::
|
|
||||||
+
|
|
||||||
--
|
|
||||||
Use markdown syntax for links in hover.
|
|
||||||
--
|
|
||||||
[[rust-analyzer.inlayHints.chainingHints]]rust-analyzer.inlayHints.chainingHints (default: `true`)::
|
[[rust-analyzer.inlayHints.chainingHints]]rust-analyzer.inlayHints.chainingHints (default: `true`)::
|
||||||
+
|
+
|
||||||
--
|
--
|
||||||
|
|
|
@ -680,12 +680,6 @@
|
||||||
"default": true,
|
"default": true,
|
||||||
"type": "boolean"
|
"type": "boolean"
|
||||||
},
|
},
|
||||||
"rust-analyzer.hoverActions.linksInHover": {
|
|
||||||
"markdownDescription": "Use markdown syntax for links in hover.",
|
|
||||||
"default": false,
|
|
||||||
"deprecationMessage": "Use hover.linksInHover instead",
|
|
||||||
"type": "boolean"
|
|
||||||
},
|
|
||||||
"rust-analyzer.inlayHints.chainingHints": {
|
"rust-analyzer.inlayHints.chainingHints": {
|
||||||
"markdownDescription": "Whether to show inlay type hints for method chains.",
|
"markdownDescription": "Whether to show inlay type hints for method chains.",
|
||||||
"default": true,
|
"default": true,
|
||||||
|
|
Loading…
Reference in a new issue