@@ -657,33 +657,29 @@ namespace ts {
657657 * position >= start and (position < end or (position === end && token is literal or keyword or identifier))
658658 */
659659 export function getTouchingPropertyName ( sourceFile : SourceFile , position : number ) : Node {
660- return getTouchingToken ( sourceFile , position , /*includeJsDocComment*/ true , n => isPropertyNameLiteral ( n ) || isKeyword ( n . kind ) ) ;
660+ return getTouchingToken ( sourceFile , position , n => isPropertyNameLiteral ( n ) || isKeyword ( n . kind ) ) ;
661661 }
662662
663663 /**
664664 * Returns the token if position is in [start, end).
665665 * If position === end, returns the preceding token if includeItemAtEndPosition(previousToken) === true
666666 */
667- export function getTouchingToken ( sourceFile : SourceFile , position : number , includeJsDocComment : boolean , includePrecedingTokenAtEndPosition ?: ( n : Node ) => boolean ) : Node {
668- return getTokenAtPositionWorker ( sourceFile , position , /*allowPositionInLeadingTrivia*/ false , includePrecedingTokenAtEndPosition , /*includeEndPosition*/ false , includeJsDocComment ) ;
667+ export function getTouchingToken ( sourceFile : SourceFile , position : number , includePrecedingTokenAtEndPosition ?: ( n : Node ) => boolean ) : Node {
668+ return getTokenAtPositionWorker ( sourceFile , position , /*allowPositionInLeadingTrivia*/ false , includePrecedingTokenAtEndPosition , /*includeEndPosition*/ false ) ;
669669 }
670670
671671 /** Returns a token if position is in [start-of-leading-trivia, end) */
672672 export function getTokenAtPosition ( sourceFile : SourceFile , position : number ) : Node {
673- return getTokenAtPositionWorker ( sourceFile , position , /*allowPositionInLeadingTrivia*/ true , /*includePrecedingTokenAtEndPosition*/ undefined , /*includeEndPosition*/ false , /*includeJsDocComment*/ true ) ;
673+ return getTokenAtPositionWorker ( sourceFile , position , /*allowPositionInLeadingTrivia*/ true , /*includePrecedingTokenAtEndPosition*/ undefined , /*includeEndPosition*/ false ) ;
674674 }
675675
676676 /** Get the token whose text contains the position */
677- function getTokenAtPositionWorker ( sourceFile : SourceFile , position : number , allowPositionInLeadingTrivia : boolean , includePrecedingTokenAtEndPosition : ( ( n : Node ) => boolean ) | undefined , includeEndPosition : boolean , includeJsDocComment : boolean ) : Node {
677+ function getTokenAtPositionWorker ( sourceFile : SourceFile , position : number , allowPositionInLeadingTrivia : boolean , includePrecedingTokenAtEndPosition : ( ( n : Node ) => boolean ) | undefined , includeEndPosition : boolean ) : Node {
678678 let current : Node = sourceFile ;
679679 outer: while ( true ) {
680680 // find the child that contains 'position'
681681 for ( const child of current . getChildren ( ) ) {
682- if ( ! includeJsDocComment && isJSDocNode ( child ) ) {
683- continue ;
684- }
685-
686- const start = allowPositionInLeadingTrivia ? child . getFullStart ( ) : child . getStart ( sourceFile , includeJsDocComment ) ;
682+ const start = allowPositionInLeadingTrivia ? child . getFullStart ( ) : child . getStart ( sourceFile , /*includeJsDoc*/ true ) ;
687683 if ( start > position ) {
688684 // If this child begins after position, then all subsequent children will as well.
689685 break ;
0 commit comments