@@ -56,7 +56,7 @@ namespace ts.NavigateTo {
5656 }
5757 }
5858
59- const matchKind = bestMatchKind ( containerMatches ) ;
59+ const matchKind = Math . min ( ... matches . map ( m => m . kind ) ) ;
6060 const isCaseSensitive = allMatchesAreCaseSensitive ( containerMatches ) ;
6161 rawItems . push ( { name, fileName, matchKind, isCaseSensitive, declaration } ) ;
6262 }
@@ -125,16 +125,14 @@ namespace ts.NavigateTo {
125125 return false ;
126126 }
127127
128- function getContainers ( declaration : Declaration ) : string [ ] {
128+ function getContainers ( declaration : Declaration ) : string [ ] | undefined {
129129 const containers : string [ ] = [ ] ;
130130
131131 // First, if we started with a computed property name, then add all but the last
132132 // portion into the container array.
133133 const name = getNameOfDeclaration ( declaration ) ;
134- if ( name . kind === SyntaxKind . ComputedPropertyName ) {
135- if ( ! tryAddComputedPropertyName ( name . expression , containers , /*includeLastPortion*/ false ) ) {
136- return undefined ;
137- }
134+ if ( name . kind === SyntaxKind . ComputedPropertyName && ! tryAddComputedPropertyName ( name . expression , containers , /*includeLastPortion*/ false ) ) {
135+ return undefined ;
138136 }
139137
140138 // Now, walk up our containers, adding all their names to the container array.
@@ -151,20 +149,6 @@ namespace ts.NavigateTo {
151149 return containers ;
152150 }
153151
154- function bestMatchKind ( matches : ReadonlyArray < PatternMatch > ) : PatternMatchKind {
155- Debug . assert ( matches . length > 0 ) ;
156- let bestMatchKind = PatternMatchKind . camelCase ;
157-
158- for ( const match of matches ) {
159- const kind = match . kind ;
160- if ( kind < bestMatchKind ) {
161- bestMatchKind = kind ;
162- }
163- }
164-
165- return bestMatchKind ;
166- }
167-
168152 function compareNavigateToItems ( i1 : RawNavigateToItem , i2 : RawNavigateToItem ) {
169153 // TODO(cyrusn): get the gamut of comparisons that VS already uses here.
170154 return compareValues ( i1 . matchKind , i2 . matchKind )
0 commit comments