From b6b25671b29133a8a2f1325094dbd871655f8560 Mon Sep 17 00:00:00 2001 From: Luca Casonato Date: Sun, 7 Nov 2021 23:26:11 +0100 Subject: fix(lsp): display signature docs as markdown (#12636) These were previously displayed as plain text. Now they are displayed as `MarkupContent` with type `Markdown`. --- cli/lsp/tsc.rs | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'cli/lsp') 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::>() .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, + }, + )), } } } -- cgit v1.2.3