Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/services/navigationBar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -310,9 +310,11 @@ namespace ts.NavigationBar {

case SyntaxKind.ExportAssignment: {
const expression = (<ExportAssignment>node).expression;
if (isObjectLiteralExpression(expression)) {
const child = isObjectLiteralExpression(expression) ? expression :
isArrowFunction(expression) || isFunctionExpression(expression) ? expression.body : undefined;
if (child) {
startNode(node);
addChildrenRecursively(expression);
addChildrenRecursively(child);
endNode();
}
else {
Expand Down
56 changes: 55 additions & 1 deletion tests/cases/fourslash/navigationItemsExportDefaultExpression.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,24 @@
/// <reference path="fourslash.ts"/>

//// const abc = 12;
//// export default function () {}
//// export default function () {
//// return class Foo {
//// }
//// }
////
//// export default () => ""
//// export default () => {
//// return class Foo {
//// }
//// }
////
//// export default function f1() {}
//// export default function f2() {
//// return class Foo {
//// }
//// }
////
//// const abc = 12;
//// export default abc;
//// export default class AB {}
//// export default {
Expand All @@ -22,11 +38,33 @@ verify.navigationTree({
"kind": "function",
"kindModifiers": "export"
},
{
"text": "default",
"kind": "function",
"kindModifiers": "export",
"childItems": [
{
"text": "Foo",
"kind": "class"
}
]
},
{
"text": "default",
"kind": "function",
"kindModifiers": "export"
},
{
"text": "default",
"kind": "function",
"kindModifiers": "export",
"childItems": [
{
"text": "Foo",
"kind": "class"
}
]
},
{
"text": "default",
"kind": "const",
Expand Down Expand Up @@ -65,6 +103,22 @@ verify.navigationTree({
"text": "default",
"kind": "const",
"kindModifiers": "export"
},
{
"text": "f1",
"kind": "function",
"kindModifiers": "export"
},
{
"text": "f2",
"kind": "function",
"kindModifiers": "export",
"childItems": [
{
"text": "Foo",
"kind": "class"
}
]
}
]
});
Expand Down
58 changes: 56 additions & 2 deletions tests/cases/fourslash/navigationItemsExportEqualsExpression.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,26 @@
// 35477
/// <reference path="fourslash.ts"/>

//// const abc = 12;
//// export = abc;
//// export = function () {}
//// export = function () {
//// return class Foo {
//// }
//// }
////
//// export = () => ""
//// export = () => {
//// return class Foo {
//// }
//// }
////
//// export = function f1() {}
//// export = function f2() {
//// return class Foo {
//// }
//// }
////
//// const abc = 12;
//// export = abc;
//// export = class AB {}
//// export = {
//// a: 1,
Expand All @@ -23,11 +39,49 @@ verify.navigationTree({
"kind": "function",
"kindModifiers": "export"
},
{
"text": "export=",
"kind": "function",
"kindModifiers": "export",
"childItems": [
{
"text": "Foo",
"kind": "class"
}
]
},
{
"text": "export=",
"kind": "function",
"kindModifiers": "export"
},
{
"text": "export=",
"kind": "function",
"kindModifiers": "export",
"childItems": [
{
"text": "Foo",
"kind": "class"
}
]
},
{
"text": "export=",
"kind": "function",
"kindModifiers": "export"
},
{
"text": "export=",
"kind": "function",
"kindModifiers": "export",
"childItems": [
{
"text": "Foo",
"kind": "class"
}
]
},
{
"text": "export=",
"kind": "class",
Expand Down