Class Selection
Expand description
Constructors§
Properties§
readonly end Column: numberColumn on which the range ends in line endLineNumber.
readonly end Line Number: numberLine number on which the range ends.
readonly position Column: numberThe column on positionLineNumber where the selection has ended.
readonly position Line Number: numberThe line number on which the selection has ended.
readonly selection Start Column: numberThe column on selectionStartLineNumber where the selection has started.
readonly selection Start Line Number: numberThe line number on which the selection has started.
readonly start Column: numberColumn on which the range starts in line startLineNumber (starts at 1).
readonly start Line Number: numberLine number on which the range starts (starts at 1).
Methods§
§containsPosition(position: IPosition): boolean
containsPosition(position: IPosition): boolean
Test if position is in this range. If the position is at the edges, will return true.
§containsRange(range: IRange): boolean
containsRange(range: IRange): boolean
Test if range is in this range. If the range is equal to this range, will return true.
§equalsSelection(other: ISelection): boolean
equalsSelection(other: ISelection): boolean
Test if equals other selection.
§getDirection(): SelectionDirection
getDirection(): SelectionDirection
Get directions (LTR or RTL).
§getEndPosition(): Position
getEndPosition(): Position
Return the end position (which will be after or equal to the start position)
§getStartPosition(): Position
getStartPosition(): Position
Return the start position (which will be before or equal to the end position)
§isEmpty(): boolean
isEmpty(): boolean
Test if this range is empty.
§isSingleLine(): boolean
isSingleLine(): boolean
§plusRange(range: IRange): Range
plusRange(range: IRange): Range
A reunion of the two ranges. The smallest position will be used as the start point, and the largest one as the end point.
§setEndPosition(
endLineNumber: number,
endColumn: number,
): Selection
setEndPosition(
endLineNumber: number,
endColumn: number,
): Selection
Create a new selection with a different positionLineNumber and positionColumn.
§setStartPosition(
startLineNumber: number,
startColumn: number,
): Selection
setStartPosition(
startLineNumber: number,
startColumn: number,
): Selection
Create a new selection with a different selectionStartLineNumber and selectionStartColumn.
§strictContainsRange(range: IRange): boolean
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.
§toString(): string
toString(): string
Transform to a human-readable representation.
§areIntersecting(a: IRange, b: IRange): boolean
areIntersecting(a: IRange, b: IRange): boolean
Test if the two ranges are intersecting. If the ranges are touching it returns true.
§areIntersectingOrTouching(a: IRange, b: IRange): boolean
areIntersectingOrTouching(a: IRange, b: IRange): boolean
Test if the two ranges are touching in any way.
§areOnlyIntersecting(a: IRange, b: IRange): boolean
areOnlyIntersecting(a: IRange, b: IRange): boolean
Test if the two ranges are intersecting, but not touching at all.
§compareRangesUsingEnds(a: IRange, b: IRange): number
compareRangesUsingEnds(a: IRange, b: IRange): number
A function that compares ranges, useful for sorting ranges It will first compare ranges on the endPosition and then on the startPosition
§compareRangesUsingStarts(a: IRange, b: IRange): number
compareRangesUsingStarts(a: IRange, b: IRange): number
A function that compares ranges, useful for sorting ranges It will first compare ranges on the startPosition and then on the endPosition
§containsPosition(
range: IRange,
position: IPosition,
): boolean
containsPosition(
range: IRange,
position: IPosition,
): boolean
Test if position is in range. If the position is at the edges, will return true.
§containsRange(range: IRange, otherRange: IRange): boolean
containsRange(range: IRange, otherRange: IRange): boolean
Test if otherRange is in range. If the ranges are equal, will return true.
§createWithDirection(
startLineNumber: number,
startColumn: number,
endLineNumber: number,
endColumn: number,
direction: SelectionDirection,
): Selection
createWithDirection(
startLineNumber: number,
startColumn: number,
endLineNumber: number,
endColumn: number,
direction: SelectionDirection,
): Selection
Create with a direction.
§fromPositions(start: IPosition, end?: IPosition): Selection
fromPositions(start: IPosition, end?: IPosition): Selection
Create a Selection from one or two positions
§fromRange(
range: Range,
direction: SelectionDirection,
): Selection
fromRange(
range: Range,
direction: SelectionDirection,
): Selection
Creates a Selection from a range, given a direction.
§getEndPosition(range: IRange): Position
getEndPosition(range: IRange): Position
Return the end position (which will be after or equal to the start position)
§getStartPosition(range: IRange): Position
getStartPosition(range: IRange): Position
Return the start position (which will be before or equal to the end position)
§isISelection(obj: unknown): obj is ISelection
isISelection(obj: unknown): obj is ISelection
Test if obj is an ISelection.
§lift(range: null): null
lift(range: null): null
Create a Range from an IRange.
§liftSelection(sel: ISelection): Selection
liftSelection(sel: ISelection): Selection
Create a Selection from an ISelection.
§plusRange(a: IRange, b: IRange): Range
plusRange(a: IRange, b: IRange): Range
A reunion of the two ranges. The smallest position will be used as the start point, and the largest one as the end point.
§selectionsArrEqual(
a: ISelection[],
b: ISelection[],
): boolean
selectionsArrEqual(
a: ISelection[],
b: ISelection[],
): boolean
a equals b.
§selectionsEqual(a: ISelection, b: ISelection): boolean
selectionsEqual(a: ISelection, b: ISelection): boolean
Test if the two selections are equal.
A selection in the editor. The selection is a range that has an orientation.