@@ -15,14 +15,18 @@ namespace ts.FindAllReferences {
15
15
| { type : "string" ; node : ts . StringLiteral } ;
16
16
17
17
export type Entry = NodeEntry | SpanEntry ;
18
- export interface NodeEntry { type : "node" ; node : Node ; }
18
+ export interface NodeEntry {
19
+ type : "node" ;
20
+ node : Node ;
21
+ isInString ?: true ;
22
+ }
19
23
interface SpanEntry {
20
24
type : "span" ;
21
25
fileName : string ;
22
26
textSpan : TextSpan ;
23
27
}
24
- export function nodeEntry ( node : ts . Node ) : NodeEntry {
25
- return { type : "node" , node } ;
28
+ export function nodeEntry ( node : ts . Node , isInString ?: true ) : NodeEntry {
29
+ return { type : "node" , node, isInString } ;
26
30
}
27
31
28
32
export interface Options {
@@ -163,13 +167,13 @@ namespace ts.FindAllReferences {
163
167
return { textSpan : entry . textSpan , fileName : entry . fileName , isWriteAccess : false , isDefinition : false } ;
164
168
}
165
169
166
- const { node } = entry ;
170
+ const { node, isInString } = entry ;
167
171
return {
168
172
fileName : node . getSourceFile ( ) . fileName ,
169
173
textSpan : getTextSpan ( node ) ,
170
174
isWriteAccess : isWriteAccess ( node ) ,
171
175
isDefinition : isDeclarationName ( node ) || isLiteralComputedPropertyDeclarationName ( node ) ,
172
- isInString : node . kind === ts . SyntaxKind . StringLiteral ? true : undefined
176
+ isInString
173
177
} ;
174
178
}
175
179
@@ -211,13 +215,13 @@ namespace ts.FindAllReferences {
211
215
return { fileName, span : { textSpan, kind : HighlightSpanKind . reference } } ;
212
216
}
213
217
214
- const { node } = entry ;
218
+ const { node, isInString } = entry ;
215
219
const fileName = entry . node . getSourceFile ( ) . fileName ;
216
220
const writeAccess = isWriteAccess ( node ) ;
217
221
const span : HighlightSpan = {
218
222
textSpan : getTextSpan ( node ) ,
219
223
kind : writeAccess ? HighlightSpanKind . writtenReference : HighlightSpanKind . reference ,
220
- isInString : node . kind === ts . SyntaxKind . StringLiteral ? true : undefined
224
+ isInString
221
225
} ;
222
226
return { fileName, span } ;
223
227
}
@@ -1355,7 +1359,7 @@ namespace ts.FindAllReferences.Core {
1355
1359
1356
1360
const type = getStringLiteralTypeForNode ( < StringLiteral > node , checker ) ;
1357
1361
if ( type === searchType ) {
1358
- references . push ( nodeEntry ( node ) ) ;
1362
+ references . push ( nodeEntry ( node , /*isInString*/ true ) ) ;
1359
1363
}
1360
1364
}
1361
1365
}
0 commit comments