TypeScript/tests/cases/fourslash/navigationBarAnonymousClassAndFunctionExpressions.ts
Jesse Trinity fd6fbdf7fe
Show more items in the navbar (#33040)
* show more items in navbar

* fixed missing node kind for property assignments

* updated navBarNestedCommonJsExports test

* updated navigationBarMerging_grandchildren test

* updated navigationBarItemsFunctions test

* updated navigationBarAnonymousClassAndFunctionExpressions test

* updated navigationBarFunctionIndirectlyInVariableDeclaration test

* updated navigationBarInitializerSpans test

* updated navigationBarItemsPropertiesDefinedInConstructors test

* updated tests

* change nav icon for properties with function-like initializers

* add test case for binding element with function-like initializer

* add navigationBarNestedObjectLiterals test

* add navigationBarFunctionLikePropertyAssignments test

* made some silly names less silly (?)

* added SpreadAssignments and ShorthandPropertyAssignments

* new wording for primary menu items
2019-09-11 15:54:27 -07:00

251 lines
6.2 KiB
TypeScript

/// <reference path="fourslash.ts" />
////global.cls = class { };
////(function() {
//// const x = () => {
//// // Presence of inner function causes x to be a top-level function.
//// function xx() {}
//// };
//// const y = {
//// // This is not a top-level function (contains nothing, but shows up in childItems of its parent.)
//// foo: function() {}
//// };
//// (function nest() {
//// function moreNest() {}
//// })();
////})();
////(function() { // Different anonymous functions are not merged
//// // These will only show up as childItems.
//// function z() {}
//// console.log(function() {})
//// describe("this", 'function', `is a function`, `but this ${"wont"} show`, () => {});
//// [].map(() => {});
////})
////(function classes() {
//// // Classes show up in top-level regardless of whether they have names or inner declarations.
//// const cls2 = class { };
//// console.log(class cls3 {});
//// (class { });
////})
verify.navigationTree({
"text": "<global>",
"kind": "script",
"childItems": [
{
"text": "<function>",
"kind": "function",
"childItems": [
{
"text": "nest",
"kind": "function",
"childItems": [
{
"text": "moreNest",
"kind": "function"
}
]
},
{
"text": "x",
"kind": "const",
"childItems": [
{
"text": "xx",
"kind": "function"
}
]
},
{
"text": "y",
"kind": "const",
"childItems": [
{
"text": "foo",
"kind": "method"
}
]
}
]
},
{
"text": "<function>",
"kind": "function",
"childItems": [
{
"text": "console.log() callback",
"kind": "function"
},
{
"text": `describe("this", 'function', \`is a function\`) callback`,
"kind": "function"
},
{
"text": `map() callback`,
"kind": "function"
},
{
"text": "z",
"kind": "function"
}
]
},
{
"text": "classes",
"kind": "function",
"childItems": [
{
"text": "<class>",
"kind": "class"
},
{
"text": "cls2",
"kind": "const"
},
{
"text": "cls3",
"kind": "class"
}
]
},
{
"text": "cls",
"kind": "class"
}
]
});
verify.navigationBar([
{
"text": "<global>",
"kind": "script",
"childItems": [
{
"text": "<function>",
"kind": "function"
},
{
"text": "<function>",
"kind": "function"
},
{
"text": "classes",
"kind": "function"
},
{
"text": "cls",
"kind": "class"
}
]
},
{
"text": "<function>",
"kind": "function",
"childItems": [
{
"text": "nest",
"kind": "function"
},
{
"text": "x",
"kind": "const"
},
{
"text": "y",
"kind": "const"
}
],
"indent": 1
},
{
"text": "nest",
"kind": "function",
"childItems": [
{
"text": "moreNest",
"kind": "function"
}
],
"indent": 2
},
{
"text": "x",
"kind": "const",
"childItems": [
{
"text": "xx",
"kind": "function"
}
],
"indent": 2
},
{
"text": "y",
"kind": "const",
"childItems": [
{
"text": "foo",
"kind": "method"
}
],
"indent": 2
},
{
"text": "<function>",
"kind": "function",
"childItems": [
{
"text": "console.log() callback",
"kind": "function"
},
{
"text": `describe("this", 'function', \`is a function\`) callback`,
"kind": "function"
},
{
"text": `map() callback`,
"kind": "function"
},
{
"text": "z",
"kind": "function"
}
],
"indent": 1
},
{
"text": "classes",
"kind": "function",
"childItems": [
{
"text": "<class>",
"kind": "class"
},
{
"text": "cls2",
"kind": "const"
},
{
"text": "cls3",
"kind": "class"
}
],
"indent": 1
},
{
"text": "<class>",
"kind": "class",
"indent": 2
},
{
"text": "cls3",
"kind": "class",
"indent": 2
},
{
"text": "cls",
"kind": "class",
"indent": 1
}
]);