prepareDocumentPaste

abstract var prepareDocumentPaste: (document: TextDocument, ReadonlyArray<Range>, dataTransfer: DataTransfer, token: CancellationToken) -> PromiseLike<Void?>??(source)

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 {@linkcode provideDocumentPasteEdits}.

Note that currently any changes to the {@linkcode 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.

Return

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

Online Documentation

Parameters

document

Text document where the copy took place.

ranges

Ranges being copied in {@linkcode document}.

dataTransfer

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

token

A cancellation token.