Represents a text editor. To close editor use 'workbench.action.closeActiveEditor' command.

Implements

Constructors

Properties

_document: DocumentDataExt
_selections: Selection[]
_viewColumn: undefined | ViewColumn
_visibleRanges: Range[]
disposed: boolean = false
id: string

Accessors

Methods

  • Perform an edit on the document associated with this text editor.

    The given callback-function is invoked with an edit-builder which must be used to make edits. Note that the edit-builder is only valid while the callback executes.

    Parameters

    • callback: ((editBuilder) => void)

      A function which can create edits using an edit-builder.

    • options: {
          undoStopAfter: boolean;
          undoStopBefore: boolean;
      } = ...

      The undo/redo behavior around this edit. By default, undo stops will be created before and after this edit.

      • undoStopAfter: boolean
      • undoStopBefore: boolean

    Returns Promise<boolean>

    A promise that resolves with a value indicating if the edits could be applied.

  • Insert a snippet and put the editor into snippet mode. "Snippet mode" means the editor adds placeholders and additional cursors so that the user can complete or accept the snippet.

    Parameters

    • snippet: SnippetString

      The snippet to insert in this edit.

    • Optional location: Position | Position[] | Range | Range[]

      Position or range at which to insert the snippet, defaults to the current editor selection or selections.

    • options: {
          undoStopAfter: boolean;
          undoStopBefore: boolean;
      } = ...

      The undo/redo behavior around this edit. By default, undo stops will be created before and after this edit.

      • undoStopAfter: boolean
      • undoStopBefore: boolean

    Returns Promise<boolean>

    A promise that resolves with a value indicating if the snippet could be inserted. Note that the promise does not signal that the snippet is completely filled-in or accepted.