@@ -8,25 +8,21 @@ namespace ts.FindAllReferences {
8
8
}
9
9
10
10
type Definition =
11
- | { type : "symbol" ; symbol : Symbol ; node : Node ; }
12
- | { type : "label" ; node : Identifier ; }
13
- | { type : "keyword" ; node : ts . Node ; }
14
- | { type : "this" ; node : ts . Node ; }
11
+ | { type : "symbol" ; symbol : Symbol ; node : Node }
12
+ | { type : "label" ; node : Identifier }
13
+ | { type : "keyword" ; node : ts . Node }
14
+ | { type : "this" ; node : ts . Node }
15
15
| { type : "string" ; node : ts . StringLiteral } ;
16
16
17
17
export type Entry = NodeEntry | SpanEntry ;
18
- export interface NodeEntry {
19
- type : "node" ;
20
- node : Node ;
21
- isInString : boolean ;
22
- }
18
+ export interface NodeEntry { type : "node" ; node : Node ; }
23
19
interface SpanEntry {
24
20
type : "span" ;
25
21
fileName : string ;
26
22
textSpan : TextSpan ;
27
23
}
28
- export function nodeEntry ( node : ts . Node , isInString = false ) : NodeEntry {
29
- return { type : "node" , node, isInString } ;
24
+ export function nodeEntry ( node : ts . Node ) : NodeEntry {
25
+ return { type : "node" , node } ;
30
26
}
31
27
32
28
export interface Options {
@@ -167,13 +163,13 @@ namespace ts.FindAllReferences {
167
163
return { textSpan : entry . textSpan , fileName : entry . fileName , isWriteAccess : false , isDefinition : false } ;
168
164
}
169
165
170
- const { node, isInString } = entry ;
166
+ const { node } = entry ;
171
167
return {
172
168
fileName : node . getSourceFile ( ) . fileName ,
173
169
textSpan : getTextSpan ( node ) ,
174
170
isWriteAccess : isWriteAccess ( node ) ,
175
171
isDefinition : isDeclarationName ( node ) || isLiteralComputedPropertyDeclarationName ( node ) ,
176
- isInString : isInString ? true : undefined
172
+ isInString : node . kind === ts . SyntaxKind . StringLiteral ? true : undefined
177
173
} ;
178
174
}
179
175
@@ -215,13 +211,13 @@ namespace ts.FindAllReferences {
215
211
return { fileName, span : { textSpan, kind : HighlightSpanKind . reference } } ;
216
212
}
217
213
218
- const { node, isInString } = entry ;
214
+ const { node } = entry ;
219
215
const fileName = entry . node . getSourceFile ( ) . fileName ;
220
216
const writeAccess = isWriteAccess ( node ) ;
221
217
const span : HighlightSpan = {
222
218
textSpan : getTextSpan ( node ) ,
223
219
kind : writeAccess ? HighlightSpanKind . writtenReference : HighlightSpanKind . reference ,
224
- isInString : isInString ? true : undefined
220
+ isInString : node . kind === ts . SyntaxKind . StringLiteral ? true : undefined
225
221
} ;
226
222
return { fileName, span } ;
227
223
}
@@ -483,7 +479,7 @@ namespace ts.FindAllReferences.Core {
483
479
references = symbolIdToReferences [ symbolId ] = [ ] ;
484
480
result . push ( { definition : { type : "symbol" , symbol : referenceSymbol , node : searchLocation } , references } ) ;
485
481
}
486
- return node => references . push ( { type : " node" , node , isInString : false } ) ;
482
+ return node => references . push ( nodeEntry ( node ) ) ;
487
483
}
488
484
489
485
function addStringOrCommentReference ( fileName : string , textSpan : TextSpan ) : void {
@@ -1359,7 +1355,7 @@ namespace ts.FindAllReferences.Core {
1359
1355
1360
1356
const type = getStringLiteralTypeForNode ( < StringLiteral > node , checker ) ;
1361
1357
if ( type === searchType ) {
1362
- references . push ( nodeEntry ( node , /*isInString*/ true ) ) ;
1358
+ references . push ( nodeEntry ( node ) ) ;
1363
1359
}
1364
1360
}
1365
1361
}
0 commit comments