Reuse vtsls logic for completion details display (#23030)
Part of https://github.com/zed-industries/zed/issues/22833, https://github.com/zed-industries/zed/issues/22267, https://github.com/zed-industries/zed/issues/22503 Before:   After:  Copies https://github.com/zed-industries/zed/pull/15087 change into `typescript-language-server`-related label details rendering code. Release Notes: - Improved typescript-language-server's completion details rendering
This commit is contained in:
parent
b6b87405b0
commit
fb65044484
1 changed files with 12 additions and 3 deletions
|
@ -212,9 +212,18 @@ impl LspAdapter for TypeScriptLspAdapter {
|
|||
_ => None,
|
||||
}?;
|
||||
|
||||
let text = match &item.detail {
|
||||
Some(detail) => format!("{} {}", item.label, detail),
|
||||
None => item.label.clone(),
|
||||
let one_line = |s: &str| s.replace(" ", "").replace('\n', " ");
|
||||
|
||||
let text = if let Some(description) = item
|
||||
.label_details
|
||||
.as_ref()
|
||||
.and_then(|label_details| label_details.description.as_ref())
|
||||
{
|
||||
format!("{} {}", item.label, one_line(description))
|
||||
} else if let Some(detail) = &item.detail {
|
||||
format!("{} {}", item.label, one_line(detail))
|
||||
} else {
|
||||
item.label.clone()
|
||||
};
|
||||
|
||||
Some(language::CodeLabel {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue