@@ -56,7 +56,7 @@ namespace ts.NavigateTo {
56
56
}
57
57
}
58
58
59
- const matchKind = bestMatchKind ( containerMatches ) ;
59
+ const matchKind = Math . min ( ... matches . map ( m => m . kind ) ) ;
60
60
const isCaseSensitive = allMatchesAreCaseSensitive ( containerMatches ) ;
61
61
rawItems . push ( { name, fileName, matchKind, isCaseSensitive, declaration } ) ;
62
62
}
@@ -125,16 +125,14 @@ namespace ts.NavigateTo {
125
125
return false ;
126
126
}
127
127
128
- function getContainers ( declaration : Declaration ) : string [ ] {
128
+ function getContainers ( declaration : Declaration ) : string [ ] | undefined {
129
129
const containers : string [ ] = [ ] ;
130
130
131
131
// First, if we started with a computed property name, then add all but the last
132
132
// portion into the container array.
133
133
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 ;
138
136
}
139
137
140
138
// Now, walk up our containers, adding all their names to the container array.
@@ -151,20 +149,6 @@ namespace ts.NavigateTo {
151
149
return containers ;
152
150
}
153
151
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
-
168
152
function compareNavigateToItems ( i1 : RawNavigateToItem , i2 : RawNavigateToItem ) {
169
153
// TODO(cyrusn): get the gamut of comparisons that VS already uses here.
170
154
return compareValues ( i1 . matchKind , i2 . matchKind )
0 commit comments