@@ -154,6 +154,16 @@ namespace ts.NavigationBar {
154154 for ( let node of nodes ) {
155155 switch ( node . kind ) {
156156 case SyntaxKind . ClassDeclaration :
157+ topLevelNodes . push ( node ) ;
158+ forEach ( ( < ClassDeclaration > node ) . members , ( node ) => {
159+ if ( node . kind === SyntaxKind . MethodDeclaration ||
160+ node . kind === SyntaxKind . Constructor ) {
161+ if ( ( < MethodDeclaration > node ) . body ) {
162+ addTopLevelNodes ( ( < Block > ( < MethodDeclaration > node ) . body ) . statements , topLevelNodes ) ;
163+ }
164+ }
165+ } ) ;
166+ break ;
157167 case SyntaxKind . EnumDeclaration :
158168 case SyntaxKind . InterfaceDeclaration :
159169 topLevelNodes . push ( node ) ;
@@ -193,6 +203,15 @@ namespace ts.NavigationBar {
193203 if ( ! isFunctionBlock ( functionDeclaration . parent ) ) {
194204 return true ;
195205 }
206+ else {
207+ // Except for parent functions that are methods and constructors.
208+ const grandParentKind = functionDeclaration . parent . parent . kind ;
209+ if ( grandParentKind === SyntaxKind . MethodDeclaration ||
210+ grandParentKind === SyntaxKind . Constructor ) {
211+
212+ return true ;
213+ }
214+ }
196215 }
197216 }
198217
@@ -407,7 +426,7 @@ namespace ts.NavigationBar {
407426
408427 function createModuleItem ( node : ModuleDeclaration ) : NavigationBarItem {
409428 let moduleName = getModuleName ( node ) ;
410-
429+
411430 let childItems = getItemsWorker ( getChildNodes ( ( < Block > getInnermostModule ( node ) . body ) . statements ) , createChildItem ) ;
412431
413432 return getNavigationBarItem ( moduleName ,
@@ -422,7 +441,7 @@ namespace ts.NavigationBar {
422441 if ( node . body && node . body . kind === SyntaxKind . Block ) {
423442 let childItems = getItemsWorker ( sortNodes ( ( < Block > node . body ) . statements ) , createChildItem ) ;
424443
425- return getNavigationBarItem ( ! node . name ? "default" : node . name . text ,
444+ return getNavigationBarItem ( ! node . name ? "default" : node . name . text ,
426445 ts . ScriptElementKind . functionElement ,
427446 getNodeModifiers ( node ) ,
428447 [ getNodeSpan ( node ) ] ,
0 commit comments