@@ -3,19 +3,19 @@ namespace ts.NavigateTo {
3
3
type RawNavigateToItem = { name : string ; fileName : string ; matchKind : PatternMatchKind ; isCaseSensitive : boolean ; declaration : Declaration } ;
4
4
5
5
export function getNavigateToItems ( program : Program , cancellationToken : CancellationToken , searchValue : string , maxResultCount : number ) : NavigateToItem [ ] {
6
- let patternMatcher = createPatternMatcher ( searchValue ) ;
6
+ const patternMatcher = createPatternMatcher ( searchValue ) ;
7
7
let rawItems : RawNavigateToItem [ ] = [ ] ;
8
8
9
9
// This means "compare in a case insensitive manner."
10
- let baseSensitivity : Intl . CollatorOptions = { sensitivity : "base" } ;
10
+ const baseSensitivity : Intl . CollatorOptions = { sensitivity : "base" } ;
11
11
12
12
// Search the declarations in all files and output matched NavigateToItem into array of NavigateToItem[]
13
13
forEach ( program . getSourceFiles ( ) , sourceFile => {
14
14
cancellationToken . throwIfCancellationRequested ( ) ;
15
15
16
- let nameToDeclarations = sourceFile . getNamedDeclarations ( ) ;
17
- for ( let name in nameToDeclarations ) {
18
- let declarations = getProperty ( nameToDeclarations , name ) ;
16
+ const nameToDeclarations = sourceFile . getNamedDeclarations ( ) ;
17
+ for ( const name in nameToDeclarations ) {
18
+ const declarations = getProperty ( nameToDeclarations , name ) ;
19
19
if ( declarations ) {
20
20
// First do a quick check to see if the name of the declaration matches the
21
21
// last portion of the (possibly) dotted name they're searching for.
@@ -25,11 +25,11 @@ namespace ts.NavigateTo {
25
25
continue ;
26
26
}
27
27
28
- for ( let declaration of declarations ) {
28
+ for ( const declaration of declarations ) {
29
29
// It was a match! If the pattern has dots in it, then also see if the
30
30
// declaration container matches as well.
31
31
if ( patternMatcher . patternContainsDots ) {
32
- let containers = getContainers ( declaration ) ;
32
+ const containers = getContainers ( declaration ) ;
33
33
if ( ! containers ) {
34
34
return undefined ;
35
35
}
@@ -41,8 +41,8 @@ namespace ts.NavigateTo {
41
41
}
42
42
}
43
43
44
- let fileName = sourceFile . fileName ;
45
- let matchKind = bestMatchKind ( matches ) ;
44
+ const fileName = sourceFile . fileName ;
45
+ const matchKind = bestMatchKind ( matches ) ;
46
46
rawItems . push ( { name, fileName, matchKind, isCaseSensitive : allMatchesAreCaseSensitive ( matches ) , declaration } ) ;
47
47
}
48
48
}
@@ -54,15 +54,15 @@ namespace ts.NavigateTo {
54
54
rawItems = rawItems . slice ( 0 , maxResultCount ) ;
55
55
}
56
56
57
- let items = map ( rawItems , createNavigateToItem ) ;
57
+ const items = map ( rawItems , createNavigateToItem ) ;
58
58
59
59
return items ;
60
60
61
61
function allMatchesAreCaseSensitive ( matches : PatternMatch [ ] ) : boolean {
62
62
Debug . assert ( matches . length > 0 ) ;
63
63
64
64
// This is a case sensitive match, only if all the submatches were case sensitive.
65
- for ( let match of matches ) {
65
+ for ( const match of matches ) {
66
66
if ( ! match . isCaseSensitive ) {
67
67
return false ;
68
68
}
@@ -86,16 +86,16 @@ namespace ts.NavigateTo {
86
86
87
87
function tryAddSingleDeclarationName ( declaration : Declaration , containers : string [ ] ) {
88
88
if ( declaration && declaration . name ) {
89
- let text = getTextOfIdentifierOrLiteral ( declaration . name ) ;
89
+ const text = getTextOfIdentifierOrLiteral ( declaration . name ) ;
90
90
if ( text !== undefined ) {
91
91
containers . unshift ( text ) ;
92
92
}
93
93
else if ( declaration . name . kind === SyntaxKind . ComputedPropertyName ) {
94
- return tryAddComputedPropertyName ( ( < ComputedPropertyName > declaration . name ) . expression , containers , /*includeLastPortion: */ true ) ;
94
+ return tryAddComputedPropertyName ( ( < ComputedPropertyName > declaration . name ) . expression , containers , /*includeLastPortion*/ true ) ;
95
95
}
96
96
else {
97
97
// Don't know how to add this.
98
- return false
98
+ return false ;
99
99
}
100
100
}
101
101
@@ -106,7 +106,7 @@ namespace ts.NavigateTo {
106
106
//
107
107
// [X.Y.Z]() { }
108
108
function tryAddComputedPropertyName ( expression : Expression , containers : string [ ] , includeLastPortion : boolean ) : boolean {
109
- let text = getTextOfIdentifierOrLiteral ( expression ) ;
109
+ const text = getTextOfIdentifierOrLiteral ( expression ) ;
110
110
if ( text !== undefined ) {
111
111
if ( includeLastPortion ) {
112
112
containers . unshift ( text ) ;
@@ -115,24 +115,24 @@ namespace ts.NavigateTo {
115
115
}
116
116
117
117
if ( expression . kind === SyntaxKind . PropertyAccessExpression ) {
118
- let propertyAccess = < PropertyAccessExpression > expression ;
118
+ const propertyAccess = < PropertyAccessExpression > expression ;
119
119
if ( includeLastPortion ) {
120
120
containers . unshift ( propertyAccess . name . text ) ;
121
121
}
122
122
123
- return tryAddComputedPropertyName ( propertyAccess . expression , containers , /*includeLastPortion: */ true ) ;
123
+ return tryAddComputedPropertyName ( propertyAccess . expression , containers , /*includeLastPortion*/ true ) ;
124
124
}
125
125
126
126
return false ;
127
127
}
128
128
129
129
function getContainers ( declaration : Declaration ) {
130
- let containers : string [ ] = [ ] ;
130
+ const containers : string [ ] = [ ] ;
131
131
132
132
// First, if we started with a computed property name, then add all but the last
133
133
// portion into the container array.
134
134
if ( declaration . name . kind === SyntaxKind . ComputedPropertyName ) {
135
- if ( ! tryAddComputedPropertyName ( ( < ComputedPropertyName > declaration . name ) . expression , containers , /*includeLastPortion: */ false ) ) {
135
+ if ( ! tryAddComputedPropertyName ( ( < ComputedPropertyName > declaration . name ) . expression , containers , /*includeLastPortion*/ false ) ) {
136
136
return undefined ;
137
137
}
138
138
}
@@ -155,8 +155,8 @@ namespace ts.NavigateTo {
155
155
Debug . assert ( matches . length > 0 ) ;
156
156
let bestMatchKind = PatternMatchKind . camelCase ;
157
157
158
- for ( let match of matches ) {
159
- let kind = match . kind ;
158
+ for ( const match of matches ) {
159
+ const kind = match . kind ;
160
160
if ( kind < bestMatchKind ) {
161
161
bestMatchKind = kind ;
162
162
}
@@ -171,13 +171,13 @@ namespace ts.NavigateTo {
171
171
// We first sort case insensitively. So "Aaa" will come before "bar".
172
172
// Then we sort case sensitively, so "aaa" will come before "Aaa".
173
173
return i1 . matchKind - i2 . matchKind ||
174
- i1 . name . localeCompare ( i2 . name , undefined , baseSensitivity ) ||
174
+ i1 . name . localeCompare ( i2 . name , undefined , baseSensitivity ) ||
175
175
i1 . name . localeCompare ( i2 . name ) ;
176
176
}
177
177
178
178
function createNavigateToItem ( rawItem : RawNavigateToItem ) : NavigateToItem {
179
- let declaration = rawItem . declaration ;
180
- let container = < Declaration > getContainerNode ( declaration ) ;
179
+ const declaration = rawItem . declaration ;
180
+ const container = < Declaration > getContainerNode ( declaration ) ;
181
181
return {
182
182
name : rawItem . name ,
183
183
kind : getNodeKind ( declaration ) ,
0 commit comments