From 85af29ffcf51b230ab34723e0d8a16d816ee79e1 Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Mon, 9 Oct 2017 15:40:53 -0700 Subject: [PATCH] Don't treat regular string SignatureInformation documentation as markdown Fixes #35937 --- src/vs/workbench/api/node/extHostTypeConverters.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/vs/workbench/api/node/extHostTypeConverters.ts b/src/vs/workbench/api/node/extHostTypeConverters.ts index ca9561d8d25..05886b82ae3 100644 --- a/src/vs/workbench/api/node/extHostTypeConverters.ts +++ b/src/vs/workbench/api/node/extHostTypeConverters.ts @@ -405,11 +405,19 @@ export namespace Suggest { } }; + +function convertSignatureDocumentation(documentation: string | types.MarkdownString): undefined | string | htmlContent.IMarkdownString { + if (!documentation) { + return undefined; + } + return typeof documentation === 'string' ? documentation : MarkdownString.from(documentation); +} + export namespace ParameterInformation { export function from(info: types.ParameterInformation): modes.ParameterInformation { return { label: info.label, - documentation: info.documentation && MarkdownString.from(info.documentation) + documentation: convertSignatureDocumentation(info.documentation) }; } export function to(info: modes.ParameterInformation): types.ParameterInformation { @@ -425,7 +433,7 @@ export namespace SignatureInformation { export function from(info: types.SignatureInformation): modes.SignatureInformation { return { label: info.label, - documentation: info.documentation && MarkdownString.from(info.documentation), + documentation: convertSignatureDocumentation(info.documentation), parameters: info.parameters && info.parameters.map(ParameterInformation.from) }; }