@@ -678,9 +678,7 @@ namespace ts.FindAllReferences.Core {
678678 return parent ? scope . getSourceFile ( ) : scope ;
679679 }
680680
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 [ ] {
684682 const positions : number [ ] = [ ] ;
685683
686684 /// TODO: Cache symbol existence for files to save text search
@@ -695,10 +693,10 @@ namespace ts.FindAllReferences.Core {
695693 const sourceLength = text . length ;
696694 const symbolNameLength = symbolName . length ;
697695
698- let position = text . indexOf ( symbolName , start ) ;
696+ let position = text . indexOf ( symbolName , container . pos ) ;
699697 while ( position >= 0 ) {
700698 // If we are past the end, stop looking
701- if ( position > end ) break ;
699+ if ( position > container . end ) break ;
702700
703701 // We found a match. Make sure it's not part of a larger word (i.e. the char
704702 // before and after it have to be a non-identifier char).
@@ -759,8 +757,7 @@ namespace ts.FindAllReferences.Core {
759757 }
760758
761759 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 ) ;
764761 for ( const position of possiblePositions ) {
765762 const referenceLocation = getTouchingPropertyName ( sourceFile , position , /*includeJsDocComment*/ true ) ;
766763 if ( referenceLocation . kind === kind ) {
@@ -784,8 +781,7 @@ namespace ts.FindAllReferences.Core {
784781 return ;
785782 }
786783
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 ) ) {
789785 getReferencesAtLocation ( sourceFile , position , search , state ) ;
790786 }
791787 }
0 commit comments