@@ -3,19 +3,19 @@ namespace ts.NavigateTo {
33 type RawNavigateToItem = { name : string ; fileName : string ; matchKind : PatternMatchKind ; isCaseSensitive : boolean ; declaration : Declaration } ;
44
55 export function getNavigateToItems ( program : Program , cancellationToken : CancellationToken , searchValue : string , maxResultCount : number ) : NavigateToItem [ ] {
6- let patternMatcher = createPatternMatcher ( searchValue ) ;
6+ const patternMatcher = createPatternMatcher ( searchValue ) ;
77 let rawItems : RawNavigateToItem [ ] = [ ] ;
88
99 // This means "compare in a case insensitive manner."
10- let baseSensitivity : Intl . CollatorOptions = { sensitivity : "base" } ;
10+ const baseSensitivity : Intl . CollatorOptions = { sensitivity : "base" } ;
1111
1212 // Search the declarations in all files and output matched NavigateToItem into array of NavigateToItem[]
1313 forEach ( program . getSourceFiles ( ) , sourceFile => {
1414 cancellationToken . throwIfCancellationRequested ( ) ;
1515
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 ) ;
1919 if ( declarations ) {
2020 // First do a quick check to see if the name of the declaration matches the
2121 // last portion of the (possibly) dotted name they're searching for.
@@ -25,11 +25,11 @@ namespace ts.NavigateTo {
2525 continue ;
2626 }
2727
28- for ( let declaration of declarations ) {
28+ for ( const declaration of declarations ) {
2929 // It was a match! If the pattern has dots in it, then also see if the
3030 // declaration container matches as well.
3131 if ( patternMatcher . patternContainsDots ) {
32- let containers = getContainers ( declaration ) ;
32+ const containers = getContainers ( declaration ) ;
3333 if ( ! containers ) {
3434 return undefined ;
3535 }
@@ -41,8 +41,8 @@ namespace ts.NavigateTo {
4141 }
4242 }
4343
44- let fileName = sourceFile . fileName ;
45- let matchKind = bestMatchKind ( matches ) ;
44+ const fileName = sourceFile . fileName ;
45+ const matchKind = bestMatchKind ( matches ) ;
4646 rawItems . push ( { name, fileName, matchKind, isCaseSensitive : allMatchesAreCaseSensitive ( matches ) , declaration } ) ;
4747 }
4848 }
@@ -54,15 +54,15 @@ namespace ts.NavigateTo {
5454 rawItems = rawItems . slice ( 0 , maxResultCount ) ;
5555 }
5656
57- let items = map ( rawItems , createNavigateToItem ) ;
57+ const items = map ( rawItems , createNavigateToItem ) ;
5858
5959 return items ;
6060
6161 function allMatchesAreCaseSensitive ( matches : PatternMatch [ ] ) : boolean {
6262 Debug . assert ( matches . length > 0 ) ;
6363
6464 // 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 ) {
6666 if ( ! match . isCaseSensitive ) {
6767 return false ;
6868 }
@@ -86,16 +86,16 @@ namespace ts.NavigateTo {
8686
8787 function tryAddSingleDeclarationName ( declaration : Declaration , containers : string [ ] ) {
8888 if ( declaration && declaration . name ) {
89- let text = getTextOfIdentifierOrLiteral ( declaration . name ) ;
89+ const text = getTextOfIdentifierOrLiteral ( declaration . name ) ;
9090 if ( text !== undefined ) {
9191 containers . unshift ( text ) ;
9292 }
9393 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 ) ;
9595 }
9696 else {
9797 // Don't know how to add this.
98- return false
98+ return false ;
9999 }
100100 }
101101
@@ -106,7 +106,7 @@ namespace ts.NavigateTo {
106106 //
107107 // [X.Y.Z]() { }
108108 function tryAddComputedPropertyName ( expression : Expression , containers : string [ ] , includeLastPortion : boolean ) : boolean {
109- let text = getTextOfIdentifierOrLiteral ( expression ) ;
109+ const text = getTextOfIdentifierOrLiteral ( expression ) ;
110110 if ( text !== undefined ) {
111111 if ( includeLastPortion ) {
112112 containers . unshift ( text ) ;
@@ -115,24 +115,24 @@ namespace ts.NavigateTo {
115115 }
116116
117117 if ( expression . kind === SyntaxKind . PropertyAccessExpression ) {
118- let propertyAccess = < PropertyAccessExpression > expression ;
118+ const propertyAccess = < PropertyAccessExpression > expression ;
119119 if ( includeLastPortion ) {
120120 containers . unshift ( propertyAccess . name . text ) ;
121121 }
122122
123- return tryAddComputedPropertyName ( propertyAccess . expression , containers , /*includeLastPortion: */ true ) ;
123+ return tryAddComputedPropertyName ( propertyAccess . expression , containers , /*includeLastPortion*/ true ) ;
124124 }
125125
126126 return false ;
127127 }
128128
129129 function getContainers ( declaration : Declaration ) {
130- let containers : string [ ] = [ ] ;
130+ const containers : string [ ] = [ ] ;
131131
132132 // First, if we started with a computed property name, then add all but the last
133133 // portion into the container array.
134134 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 ) ) {
136136 return undefined ;
137137 }
138138 }
@@ -155,8 +155,8 @@ namespace ts.NavigateTo {
155155 Debug . assert ( matches . length > 0 ) ;
156156 let bestMatchKind = PatternMatchKind . camelCase ;
157157
158- for ( let match of matches ) {
159- let kind = match . kind ;
158+ for ( const match of matches ) {
159+ const kind = match . kind ;
160160 if ( kind < bestMatchKind ) {
161161 bestMatchKind = kind ;
162162 }
@@ -171,13 +171,13 @@ namespace ts.NavigateTo {
171171 // We first sort case insensitively. So "Aaa" will come before "bar".
172172 // Then we sort case sensitively, so "aaa" will come before "Aaa".
173173 return i1 . matchKind - i2 . matchKind ||
174- i1 . name . localeCompare ( i2 . name , undefined , baseSensitivity ) ||
174+ i1 . name . localeCompare ( i2 . name , undefined , baseSensitivity ) ||
175175 i1 . name . localeCompare ( i2 . name ) ;
176176 }
177177
178178 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 ) ;
181181 return {
182182 name : rawItem . name ,
183183 kind : getNodeKind ( declaration ) ,
0 commit comments