function getRange()

in htmlhint-server/src/server.ts [37:62]


function getRange(error: htmlhint.Error, lines: string[]): any {

    let line = lines[error.line - 1];
    var isWhitespace = false;
    var curr = error.col;
    while (curr < line.length && !isWhitespace) {
        var char = line[curr];
        isWhitespace = (char === ' ' || char === '\t' || char === '\n' || char === '\r' || char === '<');
        ++curr;
    }

    if (isWhitespace) {
        --curr;
    }

    return {
        start: {
            line: error.line - 1, // Html-hint line numbers are 1-based.
            character: error.col - 1
        },
        end: {
            line: error.line - 1,
            character: curr
        }
    };
}