Interface DocumentPasteEditProvider<T>

Provider invoked when the user copies or pastes in a TextDocument.

interface DocumentPasteEditProvider<T> {
    prepareDocumentPaste?(document, ranges, dataTransfer, token): void | Thenable<void>;
    provideDocumentPasteEdits?(document, ranges, dataTransfer, context, token): ProviderResult<T[]>;
    resolveDocumentPasteEdit?(pasteEdit, token): ProviderResult<T>;
}

Type Parameters

Methods

  • Optional method invoked after the user copies from a text editor.

    This allows the provider to attach metadata about the copied text to the DataTransfer. This data transfer is then passed back to providers in provideDocumentPasteEdits.

    Note that currently any changes to the DataTransfer are isolated to the current editor window. This means that any added metadata cannot be seen by other editor windows or by other applications.

    Parameters

    • document: TextDocument

      Text document where the copy took place.

    • ranges: readonly Range[]

      Ranges being copied in document.

    • dataTransfer: DataTransfer

      The data transfer associated with the copy. You can store additional values on this for later use in provideDocumentPasteEdits. This object is only valid for the duration of this method.

    • token: CancellationToken

      A cancellation token.

    Returns void | Thenable<void>

    Optional thenable that resolves when all changes to the dataTransfer are complete.