@@ -629,7 +629,8 @@ namespace ts.NavigationBar {
629629 case SyntaxKind . SetAccessor :
630630 return hasSyntacticModifier ( a , ModifierFlags . Static ) === hasSyntacticModifier ( b , ModifierFlags . Static ) ;
631631 case SyntaxKind . ModuleDeclaration :
632- return areSameModule ( < ModuleDeclaration > a , < ModuleDeclaration > b ) ;
632+ return areSameModule ( < ModuleDeclaration > a , < ModuleDeclaration > b )
633+ && getFullyQualifiedModuleName ( < ModuleDeclaration > a ) === getFullyQualifiedModuleName ( < ModuleDeclaration > b ) ;
633634 default :
634635 return true ;
635636 }
@@ -649,7 +650,6 @@ namespace ts.NavigationBar {
649650 // We use 1 NavNode to represent 'A.B.C', but there are multiple source nodes.
650651 // Only merge module nodes that have the same chain. Don't merge 'A.B.C' with 'A'!
651652 function areSameModule ( a : ModuleDeclaration , b : ModuleDeclaration ) : boolean {
652- // TODO: GH#18217
653653 return a . body ! . kind === b . body ! . kind && ( a . body ! . kind !== SyntaxKind . ModuleDeclaration || areSameModule ( < ModuleDeclaration > a . body , < ModuleDeclaration > b . body ) ) ;
654654 }
655655
@@ -869,6 +869,10 @@ namespace ts.NavigationBar {
869869 return getTextOfNode ( moduleDeclaration . name ) ;
870870 }
871871
872+ return getFullyQualifiedModuleName ( moduleDeclaration ) ;
873+ }
874+
875+ function getFullyQualifiedModuleName ( moduleDeclaration : ModuleDeclaration ) : string {
872876 // Otherwise, we need to aggregate each identifier to build up the qualified name.
873877 const result = [ getTextOfIdentifierOrLiteral ( moduleDeclaration . name ) ] ;
874878 while ( moduleDeclaration . body && moduleDeclaration . body . kind === SyntaxKind . ModuleDeclaration ) {
0 commit comments