Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Position

A position in the editor.

Hierarchy

  • Position

Index

Constructors

constructor

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

    • lineNumber: number
    • column: number

    Returns Position

Properties

Readonly column

column: number

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

Readonly lineNumber

lineNumber: number

line number (starts at 1)

Methods

clone

  • Clone this position.

    Returns Position

delta

  • delta(deltaLineNumber?: number, deltaColumn?: number): Position
  • Derive a new position from this position.

    Parameters

    • Optional deltaLineNumber: number

      line number delta

    • Optional deltaColumn: number

      column delta

    Returns Position

equals

  • Test if this position equals other position

    Parameters

    Returns boolean

isBefore

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

    Parameters

    Returns boolean

isBeforeOrEqual

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

    Parameters

    Returns boolean

toString

  • toString(): string
  • Convert to a human-readable representation.

    Returns string

with

  • with(newLineNumber?: number, newColumn?: number): Position
  • Create a new position from this position.

    Parameters

    • Optional newLineNumber: number

      new line number

    • Optional newColumn: number

      new column

    Returns Position

Static compare

  • A function that compares positions, useful for sorting

    Parameters

    Returns number

Static equals

  • Test if position a equals position b

    Parameters

    Returns boolean

Static isBefore

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

    Parameters

    Returns boolean

Static isBeforeOrEqual

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

    Parameters

    Returns boolean

Static isIPosition

  • isIPosition(obj: any): obj is IPosition
  • Test if obj is an IPosition.

    Parameters

    • obj: any

    Returns obj is IPosition

Static lift

  • Create a Position from an IPosition.

    Parameters

    Returns Position

Generated using TypeDoc