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

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 positionColumn

positionColumn: number

The column on positionLineNumber where the selection has ended.

Readonly positionLineNumber

positionLineNumber: number

The line number on which the selection has ended.

Readonly selectionStartColumn

selectionStartColumn: number

The column on selectionStartLineNumber where the selection has started.

Readonly selectionStartLineNumber

selectionStartLineNumber: number

The line number on which the selection has started.

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

containsPosition

  • containsPosition(position: IPosition): boolean

containsRange

  • containsRange(range: IRange): boolean

equalsRange

  • equalsRange(other: IRange): 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

Static containsPosition

Static containsRange

Static createWithDirection

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

Static equalsRange

Static fromPositions

Static getEndPosition

Static getStartPosition

Static intersectRanges

Static isEmpty

  • isEmpty(range: IRange): boolean

Static isIRange

  • isIRange(obj: any): obj is IRange

Static isISelection

Static lift

Static liftSelection

Static plusRange

Static selectionsArrEqual

Static selectionsEqual

Static spansMultipleLines

  • spansMultipleLines(range: IRange): boolean

Static strictContainsRange

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