How to use the @ts-morph/common.StringUtils.getLineEndFromPos function in @ts-morph/common

To help you get started, we’ve selected a few @ts-morph/common examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github dsherret / ts-morph / packages / ts-morph / src / compiler / ast / utils / CommentNodeParser.ts View on Github external
function skipTrailingLine() {
            // skip first line of the block as the comment there is likely to describe the header
            if (pos === 0)
                return;

            let lineEnd = StringUtils.getLineEndFromPos(sourceFileText, pos);

            while (pos < lineEnd) {
                const commentKind = getCommentKind();
                if (commentKind != null) {
                    const comment = parseForComment(commentKind);
                    if (comment.kind === SyntaxKind.SingleLineCommentTrivia)
                        return;
                    else
                        lineEnd = StringUtils.getLineEndFromPos(sourceFileText, pos);
                }
                // skip any trailing comments too
                else if (!StringUtils.isWhitespace(sourceFileText[pos]) && sourceFileText[pos] !== ",")
                    return;
                else
                    pos++;
            }

            while (StringUtils.startsWithNewLine(sourceFileText[pos]))
                pos++;
        }
github dsherret / ts-morph / packages / ts-morph / src / compiler / ast / utils / CommentNodeParser.ts View on Github external
function skipTrailingLine() {
            // skip first line of the block as the comment there is likely to describe the header
            if (pos === 0)
                return;

            let lineEnd = StringUtils.getLineEndFromPos(sourceFileText, pos);

            while (pos < lineEnd) {
                const commentKind = getCommentKind();
                if (commentKind != null) {
                    const comment = parseForComment(commentKind);
                    if (comment.kind === SyntaxKind.SingleLineCommentTrivia)
                        return;
                    else
                        lineEnd = StringUtils.getLineEndFromPos(sourceFileText, pos);
                }
                // skip any trailing comments too
                else if (!StringUtils.isWhitespace(sourceFileText[pos]) && sourceFileText[pos] !== ",")
                    return;
                else
                    pos++;
            }