on master help sign in
Only write newlines in menu selection popup if the lsp returns detail (#4902)
commit6798a6651f9d314eacefddfd051661b030ca9d78 authorath3 <45574139+ath3@users.noreply.github.com> dateFri 9 Dec 2022, 04:55 (4 years ago) parentd914642
1 file changed+9−10
helix-term/src/ui/completion.rs+9−10
helix-term/src/ui/completion.rs+9−10
@@ -411,7 +411,7 @@ impl Component for Completion {
411411 "```{}\n{}\n```\n{}",
412412 language,
413413 option.detail.as_deref().unwrap_or_default(),
414− contents.clone()
414+ contents
415415 ),
416416 cx.editor.syn_loader.clone(),
417417 )
@@ -421,15 +421,14 @@ impl Component for Completion {
421421 value: contents,
422422 })) => {
423423 // TODO: set language based on doc scope
424− Markdown::new(
425− format!(
426− "```{}\n{}\n```\n{}",
427− language,
428− option.detail.as_deref().unwrap_or_default(),
429− contents.clone()
430− ),
431− cx.editor.syn_loader.clone(),
432− )
424+ if let Some(detail) = &option.detail.as_deref() {
425+ Markdown::new(
426+ format!("```{}\n{}\n```\n{}", language, detail, contents),
427+ cx.editor.syn_loader.clone(),
428+ )
429+ } else {
430+ Markdown::new(contents.to_string(), cx.editor.syn_loader.clone())
431+ }
433432 }
434433 None if option.detail.is_some() => {
435434 // TODO: copied from above