mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Merge from vscode fb5dc0083bfa9a0e3da7ed1f86e1ecb9836fcc8b
This commit is contained in:
87
src/vs/vscode.proposed.d.ts
vendored
87
src/vs/vscode.proposed.d.ts
vendored
@@ -1222,81 +1222,71 @@ declare module 'vscode' {
|
||||
// - Should we expose edits?
|
||||
// - More properties from `TextDocument`?
|
||||
|
||||
/**
|
||||
* Defines the capabilities of a custom webview editor.
|
||||
*/
|
||||
interface CustomEditorCapabilities {
|
||||
/**
|
||||
* Defines the editing capability of a custom webview document.
|
||||
*
|
||||
* When not provided, the document is considered readonly.
|
||||
*/
|
||||
readonly editing?: CustomEditorEditingCapability;
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines the editing capability of a custom webview editor. This allows the webview editor to hook into standard
|
||||
* editor events such as `undo` or `save`.
|
||||
*
|
||||
* @param EditType Type of edits.
|
||||
*/
|
||||
interface CustomEditorEditingCapability<EditType = unknown> {
|
||||
interface CustomEditorEditingDelegate<EditType = unknown> {
|
||||
/**
|
||||
* Save the resource.
|
||||
*
|
||||
* @param document Document to save.
|
||||
* @param cancellation Token that signals the save is no longer required (for example, if another save was triggered).
|
||||
*
|
||||
* @return Thenable signaling that the save has completed.
|
||||
*/
|
||||
save(cancellation: CancellationToken): Thenable<void>;
|
||||
save(document: CustomDocument, cancellation: CancellationToken): Thenable<void>;
|
||||
|
||||
/**
|
||||
* Save the existing resource at a new path.
|
||||
*
|
||||
* @param document Document to save.
|
||||
* @param targetResource Location to save to.
|
||||
*
|
||||
* @return Thenable signaling that the save has completed.
|
||||
*/
|
||||
saveAs(targetResource: Uri): Thenable<void>;
|
||||
saveAs(document: CustomDocument, targetResource: Uri): Thenable<void>;
|
||||
|
||||
/**
|
||||
* Event triggered by extensions to signal to VS Code that an edit has occurred.
|
||||
*/
|
||||
readonly onDidEdit: Event<EditType>;
|
||||
readonly onDidEdit: Event<CustomDocumentEditEvent<EditType>>;
|
||||
|
||||
/**
|
||||
* Apply a set of edits.
|
||||
*
|
||||
* Note that is not invoked when `onDidEdit` is called because `onDidEdit` implies also updating the view to reflect the edit.
|
||||
*
|
||||
* @param document Document to apply edits to.
|
||||
* @param edit Array of edits. Sorted from oldest to most recent.
|
||||
*
|
||||
* @return Thenable signaling that the change has completed.
|
||||
*/
|
||||
applyEdits(edits: readonly EditType[]): Thenable<void>;
|
||||
applyEdits(document: CustomDocument, edits: readonly EditType[]): Thenable<void>;
|
||||
|
||||
/**
|
||||
* Undo a set of edits.
|
||||
*
|
||||
* This is triggered when a user undoes an edit.
|
||||
*
|
||||
* @param document Document to undo edits from.
|
||||
* @param edit Array of edits. Sorted from most recent to oldest.
|
||||
*
|
||||
* @return Thenable signaling that the change has completed.
|
||||
*/
|
||||
undoEdits(edits: readonly EditType[]): Thenable<void>;
|
||||
undoEdits(document: CustomDocument, edits: readonly EditType[]): Thenable<void>;
|
||||
|
||||
/**
|
||||
* Revert the file to its last saved state.
|
||||
*
|
||||
* @param change Added or applied edits.
|
||||
* @param document Document to revert.
|
||||
* @param edits Added or applied edits.
|
||||
*
|
||||
* @return Thenable signaling that the change has completed.
|
||||
*/
|
||||
revert(change: {
|
||||
readonly undoneEdits: readonly EditType[];
|
||||
readonly appliedEdits: readonly EditType[];
|
||||
}): Thenable<void>;
|
||||
revert(document: CustomDocument, edits: CustomDocumentRevert<EditType>): Thenable<void>;
|
||||
|
||||
/**
|
||||
* Back up the resource in its current state.
|
||||
@@ -1311,12 +1301,50 @@ declare module 'vscode' {
|
||||
* made in quick succession, `backup` is only triggered after the last one. `backup` is not invoked when
|
||||
* `auto save` is enabled (since auto save already persists resource ).
|
||||
*
|
||||
* @param document Document to revert.
|
||||
* @param cancellation Token that signals the current backup since a new backup is coming in. It is up to your
|
||||
* extension to decided how to respond to cancellation. If for example your extension is backing up a large file
|
||||
* in an operation that takes time to complete, your extension may decide to finish the ongoing backup rather
|
||||
* than cancelling it to ensure that VS Code has some valid backup.
|
||||
*/
|
||||
backup(cancellation: CancellationToken): Thenable<void>;
|
||||
backup(document: CustomDocument, cancellation: CancellationToken): Thenable<void>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Event triggered by extensions to signal to VS Code that an edit has occurred on a CustomDocument``.
|
||||
*/
|
||||
interface CustomDocumentEditEvent<EditType = unknown> {
|
||||
/**
|
||||
* Document the edit is for.
|
||||
*/
|
||||
readonly document: CustomDocument;
|
||||
|
||||
/**
|
||||
* Object that describes the edit.
|
||||
*
|
||||
* Edit objects are passed back to your extension in `undoEdits`, `applyEdits`, and `revert`.
|
||||
*/
|
||||
readonly edit: EditType;
|
||||
|
||||
/**
|
||||
* Display name describing the edit.
|
||||
*/
|
||||
readonly label?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Data about a revert for a `CustomDocument`.
|
||||
*/
|
||||
interface CustomDocumentRevert<EditType = unknown> {
|
||||
/**
|
||||
* List of edits that were undone to get the document back to its on disk state.
|
||||
*/
|
||||
readonly undoneEdits: readonly EditType[];
|
||||
|
||||
/**
|
||||
* List of edits that were reapplied to get the document back to its on disk state.
|
||||
*/
|
||||
readonly appliedEdits: readonly EditType[];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1375,7 +1403,7 @@ declare module 'vscode' {
|
||||
*
|
||||
* @return The capabilities of the resolved document.
|
||||
*/
|
||||
resolveCustomDocument(document: CustomDocument): Thenable<CustomEditorCapabilities>;
|
||||
resolveCustomDocument(document: CustomDocument): Thenable<void>;
|
||||
|
||||
/**
|
||||
* Resolve a webview editor for a given resource.
|
||||
@@ -1393,6 +1421,13 @@ declare module 'vscode' {
|
||||
* @return Thenable indicating that the webview editor has been resolved.
|
||||
*/
|
||||
resolveCustomEditor(document: CustomDocument, webviewPanel: WebviewPanel): Thenable<void>;
|
||||
|
||||
/**
|
||||
* Defines the editing capability of a custom webview document.
|
||||
*
|
||||
* When not provided, the document is considered readonly.
|
||||
*/
|
||||
readonly editingDelegate?: CustomEditorEditingDelegate;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1438,7 +1473,7 @@ declare module 'vscode' {
|
||||
export function registerCustomEditorProvider(
|
||||
viewType: string,
|
||||
provider: CustomEditorProvider | CustomTextEditorProvider,
|
||||
webviewOptions?: WebviewPanelOptions,
|
||||
webviewOptions?: WebviewPanelOptions, // TODO: move this onto provider?
|
||||
): Disposable;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user