Range
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.
Constructor
new Range(start: Position, end: Position): Range
Properties
end: Position
start: Position
Methods
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.
with(start?: Position, end?: Position): Range
Returns a new range derived from the range instance and the specified start or end parameter.
Examples
Last updated