Align tag representation in suggestion items and hovers

pull/2748/head
Sebastian Pahnke 5 years ago
parent 5f2d3f73ab
commit 85c67d753f

@ -552,20 +552,25 @@ export class SuggestAdapter
let documentationString = displayPartsToString(details.documentation);
if (details.tags) {
for (const tag of details.tags) {
documentationString += `\n\n*@${tag.name}*`;
if (tag.name === 'param' && tag.text) {
const [paramName, ...rest] = tag.text.split(' ');
documentationString += `\`${paramName}\``;
if (rest.length > 0) documentationString += `${rest.join(' ')}`;
} else if (tag.text) {
documentationString += `${tag.text}`;
}
documentationString += `\n\n${tagToString(tag)}`;
}
}
return documentationString;
}
}
function tagToString(tag: ts.JSDocTagInfo): string {
let tagLabel = `*@${tag.name}*`;
if (tag.name === 'param' && tag.text) {
const [paramName, ...rest] = tag.text.split(' ');
tagLabel += `\`${paramName}\``;
if (rest.length > 0) tagLabel += `${rest.join(' ')}`;
} else if (tag.text) {
tagLabel += `${tag.text}`;
}
return tagLabel;
}
export class SignatureHelpAdapter
extends Adapter
implements languages.SignatureHelpProvider {
@ -653,18 +658,7 @@ export class QuickInfoAdapter
const documentation = displayPartsToString(info.documentation);
const 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')
? info.tags.map((tag) => tagToString(tag)).join(' \n\n')
: '';
const contents = displayPartsToString(info.displayParts);
return {

Loading…
Cancel
Save