Visit children of jsdoc type aliases in the binder (#45312)
* Visit children of jsdoc type aliases in the binder This sets up parent pointers. Fixes #45254 and almost certainly #45248, though I haven't figured out to repro the second case. * move incorrect parenthesis * manually set comment parent instead * Bind children of typedef where possible * add explanatory comment to binding
This commit is contained in:
parent
1cbb0bd4d3
commit
f1ce0f5528
|
@ -1666,11 +1666,15 @@ namespace ts {
|
|||
}
|
||||
|
||||
function bindJSDocTypeAlias(node: JSDocTypedefTag | JSDocCallbackTag | JSDocEnumTag) {
|
||||
setParent(node.tagName, node);
|
||||
bind(node.tagName);
|
||||
if (node.kind !== SyntaxKind.JSDocEnumTag && node.fullName) {
|
||||
// don't bind the type name yet; that's delayed until delayedBindJSDocTypedefTag
|
||||
setParent(node.fullName, node);
|
||||
setParentRecursive(node.fullName, /*incremental*/ false);
|
||||
}
|
||||
if (typeof node.comment !== "string") {
|
||||
bindEach(node.comment);
|
||||
}
|
||||
}
|
||||
|
||||
function bindJSDocClassTag(node: JSDocClassTag) {
|
||||
|
|
|
@ -530,8 +530,8 @@ namespace ts {
|
|||
visitNode(cbNode, (node as JSDocTypedefTag).fullName) ||
|
||||
(typeof (node as JSDoc).comment === "string" ? undefined : visitNodes(cbNode, cbNodes, (node as JSDoc).comment as NodeArray<JSDocComment> | undefined))
|
||||
: visitNode(cbNode, (node as JSDocTypedefTag).fullName) ||
|
||||
visitNode(cbNode, (node as JSDocTypedefTag).typeExpression)) ||
|
||||
(typeof (node as JSDoc).comment === "string" ? undefined : visitNodes(cbNode, cbNodes, (node as JSDoc).comment as NodeArray<JSDocComment> | undefined));
|
||||
visitNode(cbNode, (node as JSDocTypedefTag).typeExpression) ||
|
||||
(typeof (node as JSDoc).comment === "string" ? undefined : visitNodes(cbNode, cbNodes, (node as JSDoc).comment as NodeArray<JSDocComment> | undefined)));
|
||||
case SyntaxKind.JSDocCallbackTag:
|
||||
return visitNode(cbNode, (node as JSDocTag).tagName) ||
|
||||
visitNode(cbNode, (node as JSDocCallbackTag).fullName) ||
|
||||
|
|
105
tests/baselines/reference/quickInfoLink2.baseline
Normal file
105
tests/baselines/reference/quickInfoLink2.baseline
Normal file
|
@ -0,0 +1,105 @@
|
|||
[
|
||||
{
|
||||
"marker": {
|
||||
"fileName": "/tests/cases/fourslash/quickInfoLink2.js",
|
||||
"position": 39,
|
||||
"name": ""
|
||||
},
|
||||
"quickInfo": {
|
||||
"kind": "type",
|
||||
"kindModifiers": "",
|
||||
"textSpan": {
|
||||
"start": 16,
|
||||
"length": 23
|
||||
},
|
||||
"displayParts": [
|
||||
{
|
||||
"text": "type",
|
||||
"kind": "keyword"
|
||||
},
|
||||
{
|
||||
"text": " ",
|
||||
"kind": "space"
|
||||
},
|
||||
{
|
||||
"text": "AdditionalWallabyConfig",
|
||||
"kind": "aliasName"
|
||||
},
|
||||
{
|
||||
"text": " ",
|
||||
"kind": "space"
|
||||
},
|
||||
{
|
||||
"text": "=",
|
||||
"kind": "operator"
|
||||
},
|
||||
{
|
||||
"text": " ",
|
||||
"kind": "space"
|
||||
},
|
||||
{
|
||||
"text": "{",
|
||||
"kind": "punctuation"
|
||||
},
|
||||
{
|
||||
"text": "\n",
|
||||
"kind": "lineBreak"
|
||||
},
|
||||
{
|
||||
"text": " ",
|
||||
"kind": "space"
|
||||
},
|
||||
{
|
||||
"text": "autoDetect",
|
||||
"kind": "propertyName"
|
||||
},
|
||||
{
|
||||
"text": ":",
|
||||
"kind": "punctuation"
|
||||
},
|
||||
{
|
||||
"text": " ",
|
||||
"kind": "space"
|
||||
},
|
||||
{
|
||||
"text": "boolean",
|
||||
"kind": "keyword"
|
||||
},
|
||||
{
|
||||
"text": ";",
|
||||
"kind": "punctuation"
|
||||
},
|
||||
{
|
||||
"text": "\n",
|
||||
"kind": "lineBreak"
|
||||
},
|
||||
{
|
||||
"text": "}",
|
||||
"kind": "punctuation"
|
||||
}
|
||||
],
|
||||
"documentation": [
|
||||
{
|
||||
"text": "Additional valid Wallaby config properties\nthat aren't defined in ",
|
||||
"kind": "text"
|
||||
},
|
||||
{
|
||||
"text": "{@link ",
|
||||
"kind": "link"
|
||||
},
|
||||
{
|
||||
"text": "IWallabyConfig ",
|
||||
"kind": "linkText"
|
||||
},
|
||||
{
|
||||
"text": "}",
|
||||
"kind": "link"
|
||||
},
|
||||
{
|
||||
"text": ".",
|
||||
"kind": "text"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
12
tests/cases/fourslash/quickInfoLink2.ts
Normal file
12
tests/cases/fourslash/quickInfoLink2.ts
Normal file
|
@ -0,0 +1,12 @@
|
|||
///<reference path="fourslash.ts" />
|
||||
|
||||
// @checkJs: true
|
||||
// @Filename: quickInfoLink2.js
|
||||
//// /**
|
||||
//// * @typedef AdditionalWallabyConfig/**/ Additional valid Wallaby config properties
|
||||
//// * that aren't defined in {@link IWallabyConfig}.
|
||||
//// * @property {boolean} autoDetect
|
||||
//// */
|
||||
|
||||
verify.noErrors()
|
||||
verify.baselineQuickInfo();
|
Loading…
Reference in a new issue