Interface IEditOperationBuilder

A builder and helper for edit operations for a command.

interface IEditOperationBuilder {
    addEditOperation(range, text, forceMoveMarkers?): void;
    addTrackedEditOperation(range, text, forceMoveMarkers?): void;
    trackSelection(selection, trackPreviousOnEmpty?): string;
}

Methods

  • Add a new edit operation (a replace operation).

    Parameters

    • range: IRange

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

    • text: string

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

    • Optional forceMoveMarkers: boolean

    Returns void

  • Add a new edit operation (a replace operation). The inverse edits will be accessible in ICursorStateComputerData.getInverseEditOperations()

    Parameters

    • range: IRange

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

    • text: string

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

    • Optional forceMoveMarkers: boolean

    Returns void

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