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

cloneRange

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): 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

toString

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

    Returns string

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

  • 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): boolean
  • Test if obj is an IRange.

    Parameters

    • obj: any

    Returns boolean

Static lift

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