From a3101cd03256bc231aaeb6877811a827c300ebae Mon Sep 17 00:00:00 2001 From: Kitson Kelly Date: Sat, 17 Jun 2017 18:34:32 -0700 Subject: [PATCH] Add documentation support on hover --- src/languageFeatures.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/languageFeatures.ts b/src/languageFeatures.ts index 8657072c..19e0d9e2 100644 --- a/src/languageFeatures.ts +++ b/src/languageFeatures.ts @@ -317,10 +317,19 @@ export class QuickInfoAdapter extends Adapter implements monaco.languages.HoverP if (!info) { return; } + let documentation = ts.displayPartsToString(info.documentation); + let tags = info.tags ? info.tags.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\n') : ''; let contents = ts.displayPartsToString(info.displayParts); return { range: this._textSpanToRange(resource, info.textSpan), - contents: [contents] + contents: [ contents, documentation + (tags ? '\n\n' + tags : '') ] }; })); }