Skip to content

Commit 85bcca6

Browse files
bors[bot]weirane
andauthored
Merge #11252
11252: Fix documentation of snippet r=Veykril a=weirane Closes #11234 Co-authored-by: Wang Ruochen <[email protected]>
2 parents 8dd58ce + 01b3ce3 commit 85bcca6

File tree

2 files changed

+26
-5
lines changed

2 files changed

+26
-5
lines changed

crates/rust-analyzer/src/config.rs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1364,7 +1364,23 @@ fn manual(fields: &[(&'static str, &'static str, &[&str], &str)]) -> String {
13641364
.map(|(field, _ty, doc, default)| {
13651365
let name = format!("rust-analyzer.{}", field.replace("_", "."));
13661366
let doc = doc_comment_to_string(*doc);
1367-
format!("[[{}]]{} (default: `{}`)::\n+\n--\n{}--\n", name, name, default, doc)
1367+
if default.contains('\n') {
1368+
format!(
1369+
r#"[[{}]]{}::
1370+
+
1371+
--
1372+
Default:
1373+
----
1374+
{}
1375+
----
1376+
{}
1377+
--
1378+
"#,
1379+
name, name, default, doc
1380+
)
1381+
} else {
1382+
format!("[[{}]]{} (default: `{}`)::\n+\n--\n{}--\n", name, name, default, doc)
1383+
}
13681384
})
13691385
.collect::<String>()
13701386
}

docs/user/generated_config.adoc

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,12 @@ Only applies when `#rust-analyzer.completion.addCallParenthesis#` is set.
146146
--
147147
Whether to add parenthesis when completing functions.
148148
--
149-
[[rust-analyzer.completion.snippets]]rust-analyzer.completion.snippets (default: `{
149+
[[rust-analyzer.completion.snippets]]rust-analyzer.completion.snippets::
150+
+
151+
--
152+
Default:
153+
----
154+
{
150155
"Arc::new": {
151156
"postfix": "arc",
152157
"body": "Arc::new(${receiver})",
@@ -186,10 +191,10 @@ Whether to add parenthesis when completing functions.
186191
"description": "Wrap the expression in an `Option::Some`",
187192
"scope": "expr"
188193
}
189-
}`)::
190-
+
191-
--
194+
}
195+
----
192196
Custom completion snippets.
197+
193198
--
194199
[[rust-analyzer.completion.postfix.enable]]rust-analyzer.completion.postfix.enable (default: `true`)::
195200
+

0 commit comments

Comments
 (0)