A range in the editor. (startLineNumber,startColumn) is <= (endLineNumber,endColumn)

Hierarchy

Index

Constructors

constructor

  • new Range(startLineNumber: number, startColumn: number, endLineNumber: number, endColumn: number): Range
  • Parameters

    • startLineNumber: number
    • startColumn: number
    • endLineNumber: number
    • endColumn: number

    Returns Range

Properties

endColumn

endColumn: number

Column on which the range ends in line endLineNumber.

endLineNumber

endLineNumber: number

Line number on which the range ends.

startColumn

startColumn: number

Column on which the range starts in line startLineNumber (starts at 1).

startLineNumber

startLineNumber: number

Line number on which the range starts (starts at 1).

Methods

collapseToStart

  • collapseToStart(): Range
  • Create a new empty range using this range's start position.

    Returns Range

containsPosition

  • containsPosition(position: IPosition): boolean
  • Test if position is in this range. If the position is at the edges, will return true.

    Parameters

    Returns boolean

containsRange

  • containsRange(range: IRange): boolean
  • Test if range is in this range. If the range is equal to this range, will return true.

    Parameters

    Returns boolean

equalsRange

  • equalsRange(other: IRange | null): boolean
  • Test if this range equals other.

    Parameters

    Returns boolean

getEndPosition

  • Return the end position (which will be after or equal to the start position)

    Returns Position

getStartPosition

  • Return the start position (which will be before or equal to the end position)

    Returns Position

intersectRanges

isEmpty

  • isEmpty(): boolean

plusRange

  • A reunion of the two ranges. The smallest position will be used as the start point, and the largest one as the end point.

    Parameters

    Returns Range

setEndPosition

  • setEndPosition(endLineNumber: number, endColumn: number): Range
  • Create a new range using this range's start position, and using endLineNumber and endColumn as the end position.

    Parameters

    • endLineNumber: number
    • endColumn: number

    Returns Range

setStartPosition

  • setStartPosition(startLineNumber: number, startColumn: number): Range
  • Create a new range using this range's end position, and using startLineNumber and startColumn as the start position.

    Parameters

    • startLineNumber: number
    • startColumn: number

    Returns Range

strictContainsRange

  • strictContainsRange(range: IRange): boolean
  • Test if range is strictly in this range. range must start after and end before this range for the result to be true.

    Parameters

    Returns boolean

toString

  • toString(): string
  • Transform to a user presentable string representation.

    Returns string

Static areIntersecting

  • Test if the two ranges are intersecting. If the ranges are touching it returns true.

    Parameters

    Returns boolean

Static areIntersectingOrTouching

Static collapseToStart

Static compareRangesUsingEnds

  • A function that compares ranges, useful for sorting ranges It will first compare ranges on the endPosition and then on the startPosition

    Parameters

    Returns number

Static compareRangesUsingStarts

  • compareRangesUsingStarts(a: IRange | null | undefined, b: IRange | null | undefined): number
  • A function that compares ranges, useful for sorting ranges It will first compare ranges on the startPosition and then on the endPosition

    Parameters

    Returns number

Static containsPosition

  • Test if position is in range. If the position is at the edges, will return true.

    Parameters

    Returns boolean

Static containsRange

  • Test if otherRange is in range. If the ranges are equal, will return true.

    Parameters

    Returns boolean

Static equalsRange

Static fromPositions

Static intersectRanges

Static isEmpty

  • isEmpty(range: IRange): boolean

Static isIRange

  • isIRange(obj: any): obj
  • Test if obj is an IRange.

    Parameters

    • obj: any

    Returns obj

Static lift

  • lift(range: undefined | null): null
  • lift(range: IRange): Range

Static plusRange

  • A reunion of the two ranges. The smallest position will be used as the start point, and the largest one as the end point.

    Parameters

    Returns Range

Static spansMultipleLines

  • spansMultipleLines(range: IRange): boolean
  • Test if the range spans multiple lines.

    Parameters

    Returns boolean

Static strictContainsRange

  • strictContainsRange(range: IRange, otherRange: IRange): boolean
  • Test if otherRange is strinctly in range (must start after, and end before). If the ranges are equal, will return false.

    Parameters

    Returns boolean