summaryrefslogtreecommitdiff
path: root/cli/lsp/tsc.rs
diff options
context:
space:
mode:
authorHajime-san <41257923+Hajime-san@users.noreply.github.com>2024-05-23 04:00:14 +0900
committerGitHub <noreply@github.com>2024-05-22 12:00:14 -0700
commitcbddf468e36aaa335d6c3da6b4da055b1afc3c18 (patch)
tree31ffd7ea43826e922afed19e7231d13e4db309df /cli/lsp/tsc.rs
parent466cc68afe89581354822eb512e5036750416edc (diff)
fix(lsp): process Fenced Code Block in JSDoc on `completion` correctly (#23822)
partially fixing https://github.com/denoland/deno/issues/23820 https://github.com/denoland/deno/assets/41257923/0adb5d4e-cfd5-4195-9045-19d1c0a07a43 BTW, it is out of scope on this PR that to process type of `@param` to be an code block due to it's a bit complicated.
Diffstat (limited to 'cli/lsp/tsc.rs')
-rw-r--r--cli/lsp/tsc.rs9
1 files changed, 6 insertions, 3 deletions
diff --git a/cli/lsp/tsc.rs b/cli/lsp/tsc.rs
index 97fdb9cb6..5d5f5228c 100644
--- a/cli/lsp/tsc.rs
+++ b/cli/lsp/tsc.rs
@@ -3283,14 +3283,17 @@ impl CompletionEntryDetails {
None
};
let documentation = if let Some(parts) = &self.documentation {
+ // NOTE: similar as `QuickInfo::to_hover()`
let mut value = display_parts_to_string(parts, language_server);
if let Some(tags) = &self.tags {
- let tag_documentation = tags
+ let tags_preview = tags
.iter()
.map(|tag_info| get_tag_documentation(tag_info, language_server))
.collect::<Vec<String>>()
- .join("");
- value = format!("{value}\n\n{tag_documentation}");
+ .join(" \n\n");
+ if !tags_preview.is_empty() {
+ value = format!("{value}\n\n{tags_preview}");
+ }
}
Some(lsp::Documentation::MarkupContent(lsp::MarkupContent {
kind: lsp::MarkupKind::Markdown,