mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-12 21:28:51 +00:00
Fix documentation of snippet
This commit is contained in:
parent
0f8c96c926
commit
01b3ce3006
2 changed files with 26 additions and 5 deletions
|
@ -1364,7 +1364,23 @@ fn manual(fields: &[(&'static str, &'static str, &[&str], &str)]) -> String {
|
||||||
.map(|(field, _ty, doc, default)| {
|
.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);
|
||||||
|
if default.contains('\n') {
|
||||||
|
format!(
|
||||||
|
r#"[[{}]]{}::
|
||||||
|
+
|
||||||
|
--
|
||||||
|
Default:
|
||||||
|
----
|
||||||
|
{}
|
||||||
|
----
|
||||||
|
{}
|
||||||
|
--
|
||||||
|
"#,
|
||||||
|
name, name, default, doc
|
||||||
|
)
|
||||||
|
} else {
|
||||||
format!("[[{}]]{} (default: `{}`)::\n+\n--\n{}--\n", name, name, default, doc)
|
format!("[[{}]]{} (default: `{}`)::\n+\n--\n{}--\n", name, name, default, doc)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.collect::<String>()
|
.collect::<String>()
|
||||||
}
|
}
|
||||||
|
|
|
@ -146,7 +146,12 @@ Only applies when `#rust-analyzer.completion.addCallParenthesis#` is set.
|
||||||
--
|
--
|
||||||
Whether to add parenthesis when completing functions.
|
Whether to add parenthesis when completing functions.
|
||||||
--
|
--
|
||||||
[[rust-analyzer.completion.snippets]]rust-analyzer.completion.snippets (default: `{
|
[[rust-analyzer.completion.snippets]]rust-analyzer.completion.snippets::
|
||||||
|
+
|
||||||
|
--
|
||||||
|
Default:
|
||||||
|
----
|
||||||
|
{
|
||||||
"Arc::new": {
|
"Arc::new": {
|
||||||
"postfix": "arc",
|
"postfix": "arc",
|
||||||
"body": "Arc::new(${receiver})",
|
"body": "Arc::new(${receiver})",
|
||||||
|
@ -186,10 +191,10 @@ Whether to add parenthesis when completing functions.
|
||||||
"description": "Wrap the expression in an `Option::Some`",
|
"description": "Wrap the expression in an `Option::Some`",
|
||||||
"scope": "expr"
|
"scope": "expr"
|
||||||
}
|
}
|
||||||
}`)::
|
}
|
||||||
+
|
----
|
||||||
--
|
|
||||||
Custom completion snippets.
|
Custom completion snippets.
|
||||||
|
|
||||||
--
|
--
|
||||||
[[rust-analyzer.completion.postfix.enable]]rust-analyzer.completion.postfix.enable (default: `true`)::
|
[[rust-analyzer.completion.postfix.enable]]rust-analyzer.completion.postfix.enable (default: `true`)::
|
||||||
+
|
+
|
||||||
|
|
Loading…
Reference in a new issue