From 2aa11ada5e9c69963868e71640be8ace8ac28273 Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Wed, 10 May 2017 15:52:10 -0700 Subject: [PATCH] Address VSCode component of #26415 --- extensions/typescript/src/features/previewer.ts | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/extensions/typescript/src/features/previewer.ts b/extensions/typescript/src/features/previewer.ts index e5a8ef7f7e3..6fd8eb7e600 100644 --- a/extensions/typescript/src/features/previewer.ts +++ b/extensions/typescript/src/features/previewer.ts @@ -16,12 +16,24 @@ export function plain(parts: Proto.SymbolDisplayPart[]): string { export function tagsMarkdownPreview(tags: Proto.JSDocTagInfo[]): string { return (tags || []) - .map(tag => `*@${tag.name}*` + (tag.text ? ` — ${tag.text}` : '')) + .map(tag => { + const label = `*@${tag.name}*`; + if (!tag.text) { + return label; + } + return label + (tag.text.match(/\r\n|\n/g) ? '\n' + tag.text : ` — ${tag.text}`); + }) .join(' \n'); } export function tagsPlainPreview(tags: Proto.JSDocTagInfo[]): string { return (tags || []) - .map(tag => `@${tag.name}` + (tag.text ? ` — ${tag.text}` : '')) + .map(tag => { + const label = `@${tag.name}`; + if (!tag.text) { + return label; + } + return label + (tag.text.match(/\r\n|\n/g) ? '\n' + tag.text : ` — ${tag.text}`); + }) .join('\n'); } \ No newline at end of file