mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-26 03:29:00 +01:00
Special case rendering of @param in TS hover and completion items
This commit is contained in:
@@ -25,6 +25,21 @@ function getTagBodyText(tag: Proto.JSDocTagInfo): string | undefined {
|
||||
}
|
||||
|
||||
function getTagDocumentation(tag: Proto.JSDocTagInfo): string | undefined {
|
||||
switch (tag.name) {
|
||||
case 'param':
|
||||
const body = (tag.text || '').split(/^(\w+)\s*/);
|
||||
if (body && body.length === 3) {
|
||||
const param = body[1];
|
||||
const doc = body[2];
|
||||
const label = `*@${tag.name}* \`${param}\``;
|
||||
if (!doc) {
|
||||
return label;
|
||||
}
|
||||
return label + (doc.match(/\r\n|\n/g) ? ' \n' + doc : ` — ${doc}`);
|
||||
}
|
||||
}
|
||||
|
||||
// Generic tag
|
||||
const label = `*@${tag.name}*`;
|
||||
const text = getTagBodyText(tag);
|
||||
if (!text) {
|
||||
|
||||
Reference in New Issue
Block a user