mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-09 16:39:46 -05:00
Merge pull request #10590 from Microsoft/navbar_fn_in_var
Treat variable declaration as top-level if it has an important child.
This commit is contained in:
@@ -466,6 +466,7 @@ namespace ts.NavigationBar {
|
||||
case SyntaxKind.MethodDeclaration:
|
||||
case SyntaxKind.GetAccessor:
|
||||
case SyntaxKind.SetAccessor:
|
||||
case SyntaxKind.VariableDeclaration:
|
||||
return hasSomeImportantChild(item);
|
||||
|
||||
case SyntaxKind.ArrowFunction:
|
||||
|
||||
@@ -90,6 +90,17 @@ verify.navigationBar([
|
||||
],
|
||||
"indent": 2
|
||||
},
|
||||
{
|
||||
"text": "y",
|
||||
"kind": "const",
|
||||
"childItems": [
|
||||
{
|
||||
"text": "foo",
|
||||
"kind": "function"
|
||||
}
|
||||
],
|
||||
"indent": 2
|
||||
},
|
||||
{
|
||||
"text": "<function>",
|
||||
"kind": "function",
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
/// <reference path="fourslash.ts"/>
|
||||
|
||||
////var a = {
|
||||
//// propA: function() {}
|
||||
////};
|
||||
////var b;
|
||||
////b = {
|
||||
//// propB: function() {}
|
||||
////};
|
||||
|
||||
verify.navigationBar([
|
||||
{
|
||||
"text": "<global>",
|
||||
"kind": "script",
|
||||
"childItems": [
|
||||
{
|
||||
"text": "a",
|
||||
"kind": "var"
|
||||
},
|
||||
{
|
||||
"text": "b",
|
||||
"kind": "var"
|
||||
},
|
||||
{
|
||||
"text": "propB",
|
||||
"kind": "function"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"text": "a",
|
||||
"kind": "var",
|
||||
"childItems": [
|
||||
{
|
||||
"text": "propA",
|
||||
"kind": "function"
|
||||
}
|
||||
],
|
||||
"indent": 1
|
||||
},
|
||||
{
|
||||
"text": "propB",
|
||||
"kind": "function",
|
||||
"indent": 1
|
||||
}
|
||||
]);
|
||||
Reference in New Issue
Block a user