Add documentation support on hover

This commit is contained in:
Kitson Kelly 2017-06-17 18:34:32 -07:00
parent 9b5c885b40
commit a3101cd032
No known key found for this signature in database
GPG key ID: 545CADD213D34063

View file

@ -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 : '') ]
};
}));
}