@@ -421,14 +421,14 @@ namespace ts {
421421 }
422422
423423 export function isInComment ( sourceFile : SourceFile , position : number ) {
424- return isInCommentHelper ( sourceFile , position , /*predicate*/ c => true ) ;
424+ return isInCommentHelper ( sourceFile , position , /*predicate*/ undefined ) ;
425425 }
426426
427427 /**
428428 * Returns true if the cursor at position in sourceFile is within a comment that additionally
429429 * satisfies predicate, and false otherwise.
430430 */
431- export function isInCommentHelper ( sourceFile : SourceFile , position : number , predicate : ( c : CommentRange ) => boolean ) : boolean {
431+ export function isInCommentHelper ( sourceFile : SourceFile , position : number , predicate ? : ( c : CommentRange ) => boolean ) : boolean {
432432 let token = getTokenAtPosition ( sourceFile , position ) ;
433433
434434 if ( token && position <= token . getStart ( ) ) {
@@ -444,9 +444,12 @@ namespace ts {
444444 // /* asdf */^
445445 //
446446 // Internally, we represent the end of the comment at the newline and closing '/', respectively.
447- return forEach ( commentRanges , c => c . pos < position &&
448- ( c . kind == SyntaxKind . SingleLineCommentTrivia ? position <= c . end : position < c . end ) &&
449- predicate ( c ) ) ;
447+ return predicate ?
448+ forEach ( commentRanges , c => c . pos < position &&
449+ ( c . kind == SyntaxKind . SingleLineCommentTrivia ? position <= c . end : position < c . end ) &&
450+ predicate ( c ) ) :
451+ forEach ( commentRanges , c => c . pos < position &&
452+ ( c . kind == SyntaxKind . SingleLineCommentTrivia ? position <= c . end : position < c . end ) ) ;
450453 }
451454
452455 return false ;
@@ -458,7 +461,7 @@ namespace ts {
458461 // First, we have to see if this position actually landed in a comment.
459462 let commentRanges = getLeadingCommentRanges ( sourceFile . text , token . pos ) ;
460463
461- return forEach ( commentRanges , c => jsDocPrefix ) ;
464+ return forEach ( commentRanges , jsDocPrefix ) ;
462465
463466 function jsDocPrefix ( c : CommentRange ) : boolean {
464467 var text = sourceFile . text ;
0 commit comments