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:
Andy
2016-09-01 11:17:22 -07:00
committed by GitHub
3 changed files with 58 additions and 0 deletions

View File

@@ -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:

View File

@@ -90,6 +90,17 @@ verify.navigationBar([
],
"indent": 2
},
{
"text": "y",
"kind": "const",
"childItems": [
{
"text": "foo",
"kind": "function"
}
],
"indent": 2
},
{
"text": "<function>",
"kind": "function",

View File

@@ -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
}
]);