feat(41216): show JSDoc for aliases (#41452)

This commit is contained in:
Oleksandr T
2020-11-25 00:40:51 +02:00
committed by GitHub
parent a6ebf5d79a
commit 5adb55eb18
3 changed files with 179 additions and 0 deletions

View File

@@ -422,6 +422,10 @@ namespace ts.SymbolDisplay {
documentationFromAlias = resolvedInfo.documentation;
tagsFromAlias = resolvedInfo.tags;
}
else {
documentationFromAlias = resolvedSymbol.getContextualDocumentationComment(resolvedNode, typeChecker);
tagsFromAlias = resolvedSymbol.getJsDocTags();
}
}
}

View File

@@ -0,0 +1,162 @@
[
{
"marker": {
"fileName": "/jsDocAliasQuickInfo.ts",
"position": 44
},
"quickInfo": {
"kind": "property",
"kindModifiers": "export",
"textSpan": {
"start": 44,
"length": 7
},
"displayParts": [
{
"text": "(",
"kind": "punctuation"
},
{
"text": "property",
"kind": "text"
},
{
"text": ")",
"kind": "punctuation"
},
{
"text": " ",
"kind": "space"
},
{
"text": "default",
"kind": "propertyName"
},
{
"text": ":",
"kind": "punctuation"
},
{
"text": " ",
"kind": "space"
},
{
"text": "10",
"kind": "stringLiteral"
}
],
"documentation": [
{
"text": "Comment",
"kind": "text"
}
],
"tags": [
{
"name": "type",
"text": "{number}"
}
]
}
},
{
"marker": {
"fileName": "/test.ts",
"position": 9
},
"quickInfo": {
"kind": "property",
"kindModifiers": "export",
"textSpan": {
"start": 9,
"length": 7
},
"displayParts": [
{
"text": "(",
"kind": "punctuation"
},
{
"text": "property",
"kind": "text"
},
{
"text": ")",
"kind": "punctuation"
},
{
"text": " ",
"kind": "space"
},
{
"text": "default",
"kind": "propertyName"
},
{
"text": ":",
"kind": "punctuation"
},
{
"text": " ",
"kind": "space"
},
{
"text": "10",
"kind": "stringLiteral"
}
],
"documentation": [
{
"text": "Comment",
"kind": "text"
}
],
"tags": [
{
"name": "type",
"text": "{number}"
}
]
}
},
{
"marker": {
"fileName": "/test.ts",
"position": 20
},
"quickInfo": {
"kind": "alias",
"kindModifiers": "",
"textSpan": {
"start": 20,
"length": 4
},
"displayParts": [
{
"text": "export",
"kind": "keyword"
},
{
"text": " ",
"kind": "space"
},
{
"text": "test",
"kind": "aliasName"
}
],
"documentation": [
{
"text": "Comment",
"kind": "text"
}
],
"tags": [
{
"name": "type",
"text": "{number}"
}
]
}
}
]

View File

@@ -0,0 +1,13 @@
/// <reference path='fourslash.ts'/>
// @Filename: /jsDocAliasQuickInfo.ts
/////**
//// * Comment
//// * @type {number}
//// */
////export /*1*/default 10;
// @Filename: /test.ts
////export { /*2*/default as /*3*/test } from "./jsDocAliasQuickInfo";
verify.baselineQuickInfo();