githubEdit

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

chevron-rightend: Positionhashtag

chevron-rightisEmpty: booleanhashtag

chevron-rightisSingleLine: booleanhashtag

chevron-rightlength: numberhashtag

chevron-rightstart: Positionhashtag

Methods

chevron-rightisEqual(other: Range): booleanhashtag

Returns true if the specified range is equal to the range instance, else false.

chevron-rightcontains(positionOrRange: Position | Range): booleanhashtag

Returns true or false depending on if a specified position or range is contained within the range instance.

chevron-rightintersection(range: Range): Range | undefinedhashtag

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.

chevron-rightunion(other: Range): Rangehashtag

Returns a new range representing the combination (union) of the specified range and the range instance.

chevron-rightwith(start?: Position, end?: Position): Rangehashtag

Returns a new range derived from the range instance and the specified start or end parameter.

Examples

Last updated