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: , end: ):
Properties
end:
isEmpty: boolean
isSingleLine: boolean
length: number
Methods
Examples
start:
isEqual(other: ): boolean
Returns true if the specified range is equal to the range instance, else false.
contains(positionOrRange: | ): boolean
Returns true or false depending on if a specified position or range is contained within the range instance.
intersection(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: ):
Returns a new range representing the combination (union) of the specified range and the range instance.
with(start?: , end?: ):
Returns a new range derived from the range instance and the specified start or end parameter.