Only write newlines in menu selection popup if the lsp returns detail (#4902)

This commit is contained in:
ath3 2022-12-09 04:55:15 +01:00 committed by GitHub
parent d914642089
commit 6798a6651f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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