summaryrefslogtreecommitdiff
path: root/cli/lsp/tsc.rs
diff options
context:
space:
mode:
authorLuca Casonato <hello@lcas.dev>2021-11-07 23:26:11 +0100
committerGitHub <noreply@github.com>2021-11-07 23:26:11 +0100
commitb6b25671b29133a8a2f1325094dbd871655f8560 (patch)
tree10f2bb7f3a46c5d7b5015fdf9ab976a961f2f422 /cli/lsp/tsc.rs
parent0f8299d011420408b9a432a2c01af387af9d5fb2 (diff)
fix(lsp): display signature docs as markdown (#12636)
These were previously displayed as plain text. Now they are displayed as `MarkupContent` with type `Markdown`.
Diffstat (limited to 'cli/lsp/tsc.rs')
-rw-r--r--cli/lsp/tsc.rs20
1 files changed, 14 insertions, 6 deletions
diff --git a/cli/lsp/tsc.rs b/cli/lsp/tsc.rs
index 8f3db6131..7e3c72130 100644
--- a/cli/lsp/tsc.rs
+++ b/cli/lsp/tsc.rs
@@ -1953,11 +1953,15 @@ impl SignatureHelpItem {
.collect::<Vec<String>>()
.join(", ");
let suffix_text = display_parts_to_string(&self.suffix_display_parts);
+ let documentation = display_parts_to_string(&self.documentation);
lsp::SignatureInformation {
label: format!("{}{}{}", prefix_text, params_text, suffix_text),
- documentation: Some(lsp::Documentation::String(display_parts_to_string(
- &self.documentation,
- ))),
+ documentation: Some(lsp::Documentation::MarkupContent(
+ lsp::MarkupContent {
+ kind: lsp::MarkupKind::Markdown,
+ value: documentation,
+ },
+ )),
parameters: Some(
self
.parameters
@@ -1981,13 +1985,17 @@ pub struct SignatureHelpParameter {
impl SignatureHelpParameter {
pub fn into_parameter_information(self) -> lsp::ParameterInformation {
+ let documentation = display_parts_to_string(&self.documentation);
lsp::ParameterInformation {
label: lsp::ParameterLabel::Simple(display_parts_to_string(
&self.display_parts,
)),
- documentation: Some(lsp::Documentation::String(display_parts_to_string(
- &self.documentation,
- ))),
+ documentation: Some(lsp::Documentation::MarkupContent(
+ lsp::MarkupContent {
+ kind: lsp::MarkupKind::Markdown,
+ value: documentation,
+ },
+ )),
}
}
}