A builder and helper for edit operations for a command.

Hierarchy

  • IEditOperationBuilder

Index

Methods

addEditOperation

  • addEditOperation(range: Range, text: string | null): void
  • Add a new edit operation (a replace operation).

    Parameters

    • range: Range

      The range to replace (delete). May be empty to represent a simple insert.

    • text: string | null

      The text to replace with. May be null to represent a simple delete.

    Returns void

addTrackedEditOperation

  • addTrackedEditOperation(range: Range, text: string | null): void
  • Add a new edit operation (a replace operation). The inverse edits will be accessible in ICursorStateComputerData.getInverseEditOperations()

    Parameters

    • range: Range

      The range to replace (delete). May be empty to represent a simple insert.

    • text: string | null

      The text to replace with. May be null to represent a simple delete.

    Returns void

trackSelection

  • trackSelection(selection: Selection, trackPreviousOnEmpty?: boolean): string
  • Track selection when applying edit operations. A best effort will be made to not grow/expand the selection. An empty selection will clamp to a nearby character.

    Parameters

    • selection: Selection

      The selection to track.

    • Optional trackPreviousOnEmpty: boolean

      If set, and the selection is empty, indicates whether the selection should clamp to the previous or the next character.

    Returns string

    A unique identifier.