docs/libs/typescript.js
function isInCommentHelper(sourceFile, position, predicate) {
        var token = getTokenAtPosition(sourceFile, position);
        if (token && position <= token.getStart(sourceFile)) {
            var commentRanges = ts.getLeadingCommentRanges(sourceFile.text, token.pos);
            // The end marker of a single-line comment does not include the newline character.
            // In the following case, we are inside a comment (^ denotes the cursor position):
            //
            //    // asdf   ^\n
            //
            // But for multi-line comments, we don't want to be inside the comment in the following case:
            //
            //    /* asdf */^
            //
            // Internally, we represent the end of the comment at the newline and closing '/', respectively.
            return predicate ?
                ts.forEach(commentRanges, function (c) { return c.pos < position &&
                    (c.kind == 2 /* SingleLineCommentTrivia */ ? position <= c.end : position < c.end) &&
                    predicate(c); }) :
                ts.forEach(commentRanges, function (c) { return c.pos < position &&
                    (c.kind == 2 /* SingleLineCommentTrivia */ ? position <= c.end : position < c.end); });
        }
        return false;
    }
function isInCommentHelper(sourceFile, position, predicate) {
        var token = getTokenAtPosition(sourceFile, position);
        if (token && position <= token.getStart(sourceFile)) {
            var commentRanges = ts.getLeadingCommentRanges(sourceFile.text, token.pos);
            // The end marker of a single-line comment does not include the newline character.
            // In the following case, we are inside a comment (^ denotes the cursor position):
            //
            //    // asdf   ^\n
            //
            // But for multi-line comments, we don't want to be inside the comment in the following case:
            //
            //    /* asdf */^
            //
            // Internally, we represent the end of the comment at the newline and closing '/', respectively.
            return predicate ?
                ts.forEach(commentRanges, function (c) { return c.pos < position &&
                    (c.kind == 2 /* SingleLineCommentTrivia */ ? position <= c.end : position < c.end) &&
                    predicate(c); }) :
                ts.forEach(commentRanges, function (c) { return c.pos < position &&
                    (c.kind == 2 /* SingleLineCommentTrivia */ ? position <= c.end : position < c.end); });
        }
        return false;
    }
function isInCommentHelper ( sourceFile , position , predicate ) { var token = getTokenAtPosition ( sourceFile , position ) ; if ( token && position <= token . getStart ( sourceFile ) ) { var commentRanges = ts . getLeadingCommentRanges ( sourceFile . text , token . pos ) ; // The end marker of a single-line comment does not include the newline character. // In the following case, we are inside a comment (^ denotes the cursor position): // //    // asdf   ^\n // // But for multi-line comments, we don't want to be inside the comment in the following case: // //    /* asdf */^ // // Internally, we represent the end of the comment at the newline and closing '/', respectively. return predicate ? ts . forEach ( commentRanges , function ( c ) { return c . pos < position && ( c . kind == 2 /* SingleLineCommentTrivia */ ? position <= c . end : position < c . end ) && predicate ( c ) ; } ) : ts . forEach ( commentRanges , function ( c ) { return c . pos < position && ( c . kind == 2 /* SingleLineCommentTrivia */ ? position <= c . end : position < c . end ) ; } ) ; } return false ; }
Returns true if the cursor at position in sourceFile is within a comment that additionally
satisfies predicate, and false otherwise.
Returns true if the cursor at position in sourceFile is within a comment that additionally satisfies predicate and false otherwise .