Skip to content

Commit

Permalink
Only write newlines in menu selection popup if the lsp returns detail (
Browse files Browse the repository at this point in the history
  • Loading branch information
ath3 authored and Frederik Vestre committed Feb 6, 2023
1 parent d004cb3 commit 6d9e034
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions helix-term/src/ui/completion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
)
Expand All @@ -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
Expand Down

0 comments on commit 6d9e034

Please sign in to comment.