A selection in the editor. The selection is a range that has an orientation.

Hierarchy

Index

Constructors

constructor

  • new Selection(selectionStartLineNumber: number, selectionStartColumn: number, positionLineNumber: number, positionColumn: number): Selection

Properties

endColumn

endColumn: number

Column on which the range ends in line endLineNumber.

endLineNumber

endLineNumber: number

Line number on which the range ends.

positionColumn

positionColumn: number

The column on positionLineNumber where the selection has ended.

positionLineNumber

positionLineNumber: number

The line number on which the selection has ended.

selectionStartColumn

selectionStartColumn: number

The column on selectionStartLineNumber where the selection has started.

selectionStartLineNumber

selectionStartLineNumber: number

The line number on which the selection has started.

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

containsPosition

  • containsPosition(position: IPosition): boolean

containsRange

  • containsRange(range: IRange): boolean

equalsRange

  • equalsRange(other: IRange | null): boolean

equalsSelection

getDirection

getEndPosition

getPosition

getStartPosition

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

setStartPosition

  • setStartPosition(startLineNumber: number, startColumn: number): Selection
  • Create a new selection with a different selectionStartLineNumber and selectionStartColumn.

    Parameters

    • startLineNumber: number
    • startColumn: number

    Returns Selection

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

Static areIntersecting

Static areIntersectingOrTouching

Static collapseToStart

Static compareRangesUsingEnds

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

Static containsRange

Static createWithDirection

  • createWithDirection(startLineNumber: number, startColumn: number, endLineNumber: number, endColumn: number, direction: SelectionDirection): Selection

Static equalsRange

Static fromPositions

Static intersectRanges

Static isEmpty

  • isEmpty(range: IRange): boolean

Static isIRange

  • isIRange(obj: any): obj

Static isISelection

  • isISelection(obj: any): obj
  • Test if obj is an ISelection.

    Parameters

    • obj: any

    Returns obj

Static lift

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

Static liftSelection

Static plusRange

Static selectionsArrEqual

  • selectionsArrEqual(a: ISelection[], b: ISelection[]): boolean
  • a equals b.

    Parameters

    • a: ISelection[]
    • b: ISelection[]

    Returns boolean

Static selectionsEqual

Static spansMultipleLines

  • spansMultipleLines(range: IRange): boolean

Static strictContainsRange

  • strictContainsRange(range: IRange, otherRange: IRange): boolean