Interface TextLine

Represents a line of text, such as a line of source code.

TextLine objects are immutable. When a document changes, previously retrieved lines will not represent the latest state.

interface TextLine {
    firstNonWhitespaceCharacterIndex: number;
    isEmptyOrWhitespace: boolean;
    lineNumber: number;
    range: Range;
    rangeIncludingLineBreak: Range;
    text: string;
}

Properties

firstNonWhitespaceCharacterIndex: number

The offset of the first character which is not a whitespace character as defined by /\s/. Note that if a line is all whitespaces the length of the line is returned.

isEmptyOrWhitespace: boolean

Whether this line is whitespace only, shorthand for TextLine.firstNonWhitespaceCharacterIndex === TextLine.text.length.

lineNumber: number

The zero-based line number.

range: Range

The range this line covers without the line separator characters.

rangeIncludingLineBreak: Range

The range this line covers with the line separator characters.

text: string

The text of this line without the line separator characters.