Skip to content

Commit 46e2c49

Browse files
YaLTeRautozimu
authored andcommitted
Fix newlines being trimmed from a MarkedString
1 parent ef5e2f3 commit 46e2c49

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/types.rs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -515,11 +515,15 @@ impl ToDisplay for lsp::MarkedString {
515515
fn to_display(&self) -> Vec<String> {
516516
match *self {
517517
MarkedString::String(ref s) => s.split('\n').map(|i| i.to_string()).collect(),
518-
MarkedString::LanguageString(ref ls) => vec![
519-
format!("```{}", ls.language),
520-
ls.value.split('\n').map(|i| i.to_string()).collect(),
521-
"```".to_string(),
522-
],
518+
MarkedString::LanguageString(ref ls) => {
519+
let mut buf = Vec::new();
520+
521+
buf.push(format!("```{}", ls.language));
522+
buf.extend(ls.value.split('\n').map(|i| i.to_string()));
523+
buf.push("```".to_string());
524+
525+
buf
526+
},
523527
}
524528
}
525529
}

0 commit comments

Comments
 (0)