Fix documentation of snippet

This commit is contained in:
Wang Ruochen 2022-01-10 20:47:54 -08:00
parent 0f8c96c926
commit 01b3ce3006
No known key found for this signature in database
GPG Key ID: C6DEA570A3B026FC
2 changed files with 26 additions and 5 deletions

View File

@ -1364,7 +1364,23 @@ fn manual(fields: &[(&'static str, &'static str, &[&str], &str)]) -> String {
.map(|(field, _ty, doc, default)| {
let name = format!("rust-analyzer.{}", field.replace("_", "."));
let doc = doc_comment_to_string(*doc);
format!("[[{}]]{} (default: `{}`)::\n+\n--\n{}--\n", name, name, default, doc)
if default.contains('\n') {
format!(
r#"[[{}]]{}::
+
--
Default:
----
{}
----
{}
--
"#,
name, name, default, doc
)
} else {
format!("[[{}]]{} (default: `{}`)::\n+\n--\n{}--\n", name, name, default, doc)
}
})
.collect::<String>()
}

View File

@ -146,7 +146,12 @@ Only applies when `#rust-analyzer.completion.addCallParenthesis#` is set.
--
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": {
"postfix": "arc",
"body": "Arc::new(${receiver})",
@ -186,10 +191,10 @@ Whether to add parenthesis when completing functions.
"description": "Wrap the expression in an `Option::Some`",
"scope": "expr"
}
}`)::
+
--
}
----
Custom completion snippets.
--
[[rust-analyzer.completion.postfix.enable]]rust-analyzer.completion.postfix.enable (default: `true`)::
+