Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Range

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

Readonly endColumn

endColumn: number

Column on which the range ends in line endLineNumber.

Readonly endLineNumber

endLineNumber: number

Line number on which the range ends.

Readonly startColumn

startColumn: number

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

Readonly 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

  • A intersection of the two ranges.

    Parameters

    Returns Range | null

isEmpty

  • isEmpty(): boolean
  • Test if this range is empty.

    Returns 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

  • Test if the two ranges are touching in any way.

    Parameters

    Returns boolean

Static collapseToStart

  • Create a new empty range using this range's start position.

    Parameters

    Returns Range

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

  • Test if range a equals b.

    Parameters

    Returns boolean

Static fromPositions

  • Parameters

    Returns Range

Static getEndPosition

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

    Parameters

    Returns Position

Static getStartPosition

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

    Parameters

    Returns Position

Static intersectRanges

  • A intersection of the two ranges.

    Parameters

    Returns Range | null

Static isEmpty

  • isEmpty(range: IRange): boolean
  • Test if range is empty.

    Parameters

    Returns boolean

Static isIRange

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

    Parameters

    • obj: any

    Returns obj is IRange

Static lift

  • lift(range: undefined | null): null
  • lift(range: IRange): Range
  • Create a Range from an IRange.

    Parameters

    • range: undefined | null

    Returns null

  • Parameters

    Returns 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

Generated using TypeDoc