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>()
}