Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Selection

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
  • Parameters

    • selectionStartLineNumber: number
    • selectionStartColumn: number
    • positionLineNumber: number
    • positionColumn: number

    Returns 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
  • 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

equalsSelection

  • Test if equals other selection.

    Parameters

    Returns boolean

getDirection

  • Get directions (LTR or RTL).

    Returns SelectionDirection

getEndPosition

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

    Returns Position

getPosition

  • Get the position at positionLineNumber and positionColumn.

    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): Selection
  • Create a new selection with a different positionLineNumber and positionColumn.

    Parameters

    • endLineNumber: number
    • endColumn: number

    Returns 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
  • Transform to a human-readable 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

  • 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 createWithDirection

  • createWithDirection(startLineNumber: number, startColumn: number, endLineNumber: number, endColumn: number, direction: SelectionDirection): Selection
  • Create with a direction.

    Parameters

    • startLineNumber: number
    • startColumn: number
    • endLineNumber: number
    • endColumn: number
    • direction: SelectionDirection

    Returns Selection

Static equalsRange

  • Test if range a equals b.

    Parameters

    Returns boolean

Static fromPositions

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

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 isISelection

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

    Parameters

    • obj: any

    Returns obj is ISelection

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 liftSelection

  • Create a Selection from an ISelection.

    Parameters

    Returns Selection

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 selectionsArrEqual

  • a equals b.

    Parameters

    Returns boolean

Static selectionsEqual

  • Test if the two selections are equal.

    Parameters

    Returns boolean

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