A range represents an ordered pair of two positions and is used to reference an area of text inside of a TextEditor object. Range objects are immutable.
new Range(start:
Position
, end:
Position
):
Range
``
end: Position
isEmpty: boolean
isSingleLine: boolean
length: number
start: Position
isEqual(other: Range): boolean
Returns true if the specified range is equal to the range instance, else false.
contains(positionOrRange: Position | Range): boolean
Returns true or false depending on if a specified position or range is contained within the range instance.
intersection(range: Range): Range | undefined
Returns a new range object representing the portion of the specified range that overlaps (intersects) the range instance. Undefined is returned if the compared ranges do not overlap.
union(other: Range): Range
Returns a new range representing the combination (union) of the specified range and the range instance.