提交 173fc447 编写于 作者: M Matt Bierner

Support Tags in TS/JS Hover Provider

Fixes #26290

Adds support for displaying documentation tags from jsdoc comments (such as `@private`) in hovers
上级 e4950d10
......@@ -29,7 +29,7 @@ export default class TypeScriptHoverProvider implements HoverProvider {
if (response && response.body) {
const data = response.body;
return new Hover(
[{ language: 'typescript', value: data.displayString }, data.documentation],
TypeScriptHoverProvider.getContents(data),
new Range(data.start.line - 1, data.start.offset - 1, data.end.line - 1, data.end.offset - 1));
}
return undefined;
......@@ -38,4 +38,15 @@ export default class TypeScriptHoverProvider implements HoverProvider {
return null;
});
}
private static getContents(data: Proto.QuickInfoResponseBody) {
const tags: string[] = [];
for (const tag of data.tags || []) {
tags.push(`*@${tag.name}*` + (tag.text ? ` — ${tag.text}` : ''));
}
return [
{ language: 'typescript', value: data.displayString },
data.documentation + (tags.length ? '\n\n' + tags.join(' \n') : '')
];
}
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册