@@ -678,9 +678,7 @@ namespace ts.FindAllReferences.Core {
678
678
return parent ? scope . getSourceFile ( ) : scope ;
679
679
}
680
680
681
- function getPossibleSymbolReferencePositions ( sourceFile : SourceFile , symbolName : string , container : Node = sourceFile , fullStart = false ) : number [ ] {
682
- const start = fullStart ? container . getFullStart ( ) : container . getStart ( sourceFile ) ;
683
- const end = container . getEnd ( ) ;
681
+ function getPossibleSymbolReferencePositions ( sourceFile : SourceFile , symbolName : string , container : Node = sourceFile ) : number [ ] {
684
682
const positions : number [ ] = [ ] ;
685
683
686
684
/// TODO: Cache symbol existence for files to save text search
@@ -695,10 +693,10 @@ namespace ts.FindAllReferences.Core {
695
693
const sourceLength = text . length ;
696
694
const symbolNameLength = symbolName . length ;
697
695
698
- let position = text . indexOf ( symbolName , start ) ;
696
+ let position = text . indexOf ( symbolName , container . pos ) ;
699
697
while ( position >= 0 ) {
700
698
// If we are past the end, stop looking
701
- if ( position > end ) break ;
699
+ if ( position > container . end ) break ;
702
700
703
701
// We found a match. Make sure it's not part of a larger word (i.e. the char
704
702
// before and after it have to be a non-identifier char).
@@ -759,8 +757,7 @@ namespace ts.FindAllReferences.Core {
759
757
}
760
758
761
759
function addReferencesForKeywordInFile ( sourceFile : SourceFile , kind : SyntaxKind , searchText : string , references : Push < NodeEntry > ) : void {
762
- // Want fullStart so we can find the symbol in JSDoc comments
763
- const possiblePositions = getPossibleSymbolReferencePositions ( sourceFile , searchText , sourceFile , /*fullStart*/ true ) ;
760
+ const possiblePositions = getPossibleSymbolReferencePositions ( sourceFile , searchText , sourceFile ) ;
764
761
for ( const position of possiblePositions ) {
765
762
const referenceLocation = getTouchingPropertyName ( sourceFile , position , /*includeJsDocComment*/ true ) ;
766
763
if ( referenceLocation . kind === kind ) {
@@ -784,8 +781,7 @@ namespace ts.FindAllReferences.Core {
784
781
return ;
785
782
}
786
783
787
- // Need to search in the full start of the node in case there is a reference inside JSDoc.
788
- for ( const position of getPossibleSymbolReferencePositions ( sourceFile , search . text , container , /*fullStart*/ true ) ) {
784
+ for ( const position of getPossibleSymbolReferencePositions ( sourceFile , search . text , container ) ) {
789
785
getReferencesAtLocation ( sourceFile , position , search , state ) ;
790
786
}
791
787
}
0 commit comments