fix(39899): include in NavigationBar default exported call expression arguments (#40412)

This commit is contained in:
Alex T
2020-09-18 13:06:56 -07:00
committed by GitHub
parent 0c08138490
commit 6c6ddfe5c0
2 changed files with 24 additions and 7 deletions
+2 -7
View File
@@ -310,7 +310,7 @@ namespace ts.NavigationBar {
case SyntaxKind.ExportAssignment: {
const expression = (<ExportAssignment>node).expression;
const child = isObjectLiteralExpression(expression) ? expression :
const child = isObjectLiteralExpression(expression) || isCallExpression(expression) ? expression :
isArrowFunction(expression) || isFunctionExpression(expression) ? expression.body : undefined;
if (child) {
startNode(node);
@@ -843,16 +843,11 @@ namespace ts.NavigationBar {
}
// Otherwise, we need to aggregate each identifier to build up the qualified name.
const result: string[] = [];
result.push(getTextOfIdentifierOrLiteral(moduleDeclaration.name));
const result = [getTextOfIdentifierOrLiteral(moduleDeclaration.name)];
while (moduleDeclaration.body && moduleDeclaration.body.kind === SyntaxKind.ModuleDeclaration) {
moduleDeclaration = <ModuleDeclaration>moduleDeclaration.body;
result.push(getTextOfIdentifierOrLiteral(moduleDeclaration.name));
}
return result.join(".");
}
@@ -28,6 +28,9 @@
//// d: 1
//// }
//// }
////
//// function foo(props: { x: number; y: number }) {}
//// export default foo({ x: 1, y: 1 });
verify.navigationTree({
"text": '"navigationItemsExportDefaultExpression"',
@@ -90,6 +93,21 @@ verify.navigationTree({
}
]
},
{
"text": "default",
"kind": "const",
"kindModifiers": "export",
"childItems": [
{
"text": "x",
"kind": "property"
},
{
"text": "y",
"kind": "property"
}
]
},
{
"text": "AB",
"kind": "class",
@@ -119,6 +137,10 @@ verify.navigationTree({
"kind": "class"
}
]
},
{
"text": "foo",
"kind": "function"
}
]
});