Class Position

Expand description

A position in the editor.

Constructors§

§

new Position(lineNumber: number, column: number): Position

Properties§

§readonly column: number

column (the first character in a line is between column 1 and column 2)

§readonly lineNumber: number

line number (starts at 1)

Methods§

§

clone(): Position

Clone this position.

§

delta(
    deltaLineNumber?: number,
    deltaColumn?: number,
): Position

Derive a new position from this position.

§

equals(other: IPosition): boolean

Test if this position equals other position

§

isBefore(other: IPosition): boolean

Test if this position is before other position. If the two positions are equal, the result will be false.

§

isBeforeOrEqual(other: IPosition): boolean

Test if this position is before other position. If the two positions are equal, the result will be true.

§

toJSON(): IPosition

§

toString(): string

Convert to a human-readable representation.

§

with(newLineNumber?: number, newColumn?: number): Position

Create a new position from this position.

§

compare(a: IPosition, b: IPosition): number

A function that compares positions, useful for sorting

§

equals(a: IPosition, b: IPosition): boolean

Test if position a equals position b

§

isBefore(a: IPosition, b: IPosition): boolean

Test if position a is before position b. If the two positions are equal, the result will be false.

§

isBeforeOrEqual(a: IPosition, b: IPosition): boolean

Test if position a is before position b. If the two positions are equal, the result will be true.

§

isIPosition(obj: unknown): obj is IPosition

Test if obj is an IPosition.

§

lift(pos: IPosition): Position

Create a Position from an IPosition.