Optional
prepareOptional 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.
Text document where the copy took place.
Ranges being copied in document.
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.
A cancellation token.
Optional thenable that resolves when all changes to the dataTransfer
are complete.
Optional
provideInvoked before the user pastes into a text editor.
Returned edits can replace the standard pasting behavior.
Document being pasted into
Range in the document to paste into.
The data transfer associated with the paste. This object is only valid for the duration of the paste operation.
Additional context for the paste.
A cancellation token.
Set of potential edits that can apply the paste. Only a single returned
DocumentPasteEdit
is applied at a time. If multiple edits are returned from all providers, then
the first is automatically applied and a widget is shown that lets the user switch to the other edits.
Optional
resolveOptional method which fills in the DocumentPasteEdit.additionalEdit
before the edit is applied.
This is called once per edit and should be used if generating the complete edit may take a long time.
Resolve can only be used to change DocumentPasteEdit.additionalEdit
.
The DocumentPasteEdit
to resolve.
A cancellation token.
The resolved paste edit or a thenable that resolves to such. It is OK to return the given
pasteEdit
. If no result is returned, the given pasteEdit
is used.
Provider invoked when the user copies or pastes in a
TextDocument
.