Interface TextEditChange

A change to capture text edits for existing resources.

interface TextEditChange {
    add(edit: TextEdit | AnnotatedTextEdit | SnippetTextEdit): void;
    all(): (TextEdit | AnnotatedTextEdit | SnippetTextEdit)[];
    clear(): void;
    delete(range: Range): void;
    delete(range: Range, annotation?: string | ChangeAnnotation): string;
    insert(position: Position, newText: string): void;
    insert(
        position: Position,
        newText: string,
        annotation: string | ChangeAnnotation,
    ): string;
    replace(range: Range, newText: string): void;
    replace(
        range: Range,
        newText: string,
        annotation?: string | ChangeAnnotation,
    ): string;
}

Methods

  • Adds a text edit.

    Parameters

    Returns void

    3.16.0 - support for annotated text edits. This is usually guarded using a client capability.

    3.18.0 - support for snippet text edits. This is usually guarded using a client capability.

  • Gets all text edits for this change.

    Returns (TextEdit | AnnotatedTextEdit | SnippetTextEdit)[]

    An array of text edits.

    3.16.0 - support for annotated text edits. This is usually guarded using a client capability.

    3.18.0 - support for snippet text edits. This is usually guarded using a client capability.

  • Clears the edits for this change.

    Returns void

  • Delete the text at the given range.

    Parameters

    Returns void

  • Parameters

    Returns string

  • Insert the given text at the given position.

    Parameters

    • position: Position

      A position.

    • newText: string

      A string.

    Returns void

  • Parameters

    Returns string

  • Replace the given range with given text for the given resource.

    Parameters

    • range: Range

      A range.

    • newText: string

      A string.

    Returns void

  • Parameters

    Returns string