summaryrefslogtreecommitdiff
path: root/helix-term/src/ui
diff options
context:
space:
mode:
authorath32022-12-09 03:55:15 +0000
committerGitHub2022-12-09 03:55:15 +0000
commit6798a6651f9d314eacefddfd051661b030ca9d78 (patch)
tree29772c1ea8ee825e193e43c56df31ca4d8adab7f /helix-term/src/ui
parentd91464208958b6f44b431d244e0f369d7907ba59 (diff)
Only write newlines in menu selection popup if the lsp returns detail (#4902)
Diffstat (limited to 'helix-term/src/ui')
-rw-r--r--helix-term/src/ui/completion.rs19
1 files changed, 9 insertions, 10 deletions
diff --git a/helix-term/src/ui/completion.rs b/helix-term/src/ui/completion.rs
index c54990e8..11d7886a 100644
--- a/helix-term/src/ui/completion.rs
+++ b/helix-term/src/ui/completion.rs
@@ -411,7 +411,7 @@ impl Component for Completion {
"```{}\n{}\n```\n{}",
language,
option.detail.as_deref().unwrap_or_default(),
- contents.clone()
+ contents
),
cx.editor.syn_loader.clone(),
)
@@ -421,15 +421,14 @@ impl Component for Completion {
value: contents,
})) => {
// TODO: set language based on doc scope
- Markdown::new(
- format!(
- "```{}\n{}\n```\n{}",
- language,
- option.detail.as_deref().unwrap_or_default(),
- contents.clone()
- ),
- cx.editor.syn_loader.clone(),
- )
+ if let Some(detail) = &option.detail.as_deref() {
+ Markdown::new(
+ format!("```{}\n{}\n```\n{}", language, detail, contents),
+ cx.editor.syn_loader.clone(),
+ )
+ } else {
+ Markdown::new(contents.to_string(), cx.editor.syn_loader.clone())
+ }
}
None if option.detail.is_some() => {
// TODO: copied from above