@@ -279,7 +279,7 @@ namespace ts.FindAllReferences.Core {
279
279
if ( ! symbol ) {
280
280
// String literal might be a property (and thus have a symbol), so do this here rather than in getReferencedSymbolsSpecial.
281
281
if ( ! options . implementations && node . kind === SyntaxKind . StringLiteral ) {
282
- return getReferencesForStringLiteral ( < StringLiteral > node , sourceFiles , checker , cancellationToken ) ;
282
+ return getReferencesForStringLiteral ( < StringLiteral > node , sourceFiles , cancellationToken ) ;
283
283
}
284
284
// Can't have references to something that we have no symbol for.
285
285
return undefined ;
@@ -1328,37 +1328,24 @@ namespace ts.FindAllReferences.Core {
1328
1328
}
1329
1329
}
1330
1330
1331
- function getReferencesForStringLiteral ( node : StringLiteral , sourceFiles : SourceFile [ ] , checker : TypeChecker , cancellationToken : CancellationToken ) : SymbolAndEntries [ ] {
1332
- const type = getStringLiteralTypeForNode ( node , checker ) ;
1333
-
1334
- if ( ! type ) {
1335
- // nothing to do here. moving on
1336
- return undefined ;
1337
- }
1338
-
1331
+ function getReferencesForStringLiteral ( node : StringLiteral , sourceFiles : SourceFile [ ] , cancellationToken : CancellationToken ) : SymbolAndEntries [ ] {
1339
1332
const references : NodeEntry [ ] = [ ] ;
1340
1333
1341
1334
for ( const sourceFile of sourceFiles ) {
1342
- const possiblePositions = getPossibleSymbolReferencePositions ( sourceFile , type . text , sourceFile . getStart ( ) , sourceFile . getEnd ( ) , cancellationToken ) ;
1343
- getReferencesForStringLiteralInFile ( sourceFile , type , possiblePositions , references ) ;
1335
+ cancellationToken . throwIfCancellationRequested ( ) ;
1336
+ const possiblePositions = getPossibleSymbolReferencePositions ( sourceFile , node . text , sourceFile . getStart ( ) , sourceFile . getEnd ( ) , cancellationToken ) ;
1337
+ getReferencesForStringLiteralInFile ( sourceFile , node . text , possiblePositions , references ) ;
1344
1338
}
1345
1339
1346
1340
return [ {
1347
1341
definition : { type : "string" , node } ,
1348
1342
references
1349
1343
} ] ;
1350
1344
1351
- function getReferencesForStringLiteralInFile ( sourceFile : SourceFile , searchType : Type , possiblePositions : number [ ] , references : Push < NodeEntry > ) : void {
1345
+ function getReferencesForStringLiteralInFile ( sourceFile : SourceFile , searchText : string , possiblePositions : number [ ] , references : Push < NodeEntry > ) : void {
1352
1346
for ( const position of possiblePositions ) {
1353
- cancellationToken . throwIfCancellationRequested ( ) ;
1354
-
1355
1347
const node = getTouchingWord ( sourceFile , position ) ;
1356
- if ( ! node || node . kind !== SyntaxKind . StringLiteral ) {
1357
- return ;
1358
- }
1359
-
1360
- const type = getStringLiteralTypeForNode ( < StringLiteral > node , checker ) ;
1361
- if ( type === searchType ) {
1348
+ if ( node && node . kind === SyntaxKind . StringLiteral && ( node as StringLiteral ) . text === searchText ) {
1362
1349
references . push ( nodeEntry ( node , /*isInString*/ true ) ) ;
1363
1350
}
1364
1351
}
0 commit comments