提交 efd7548d 编写于 作者: M Matt Bierner

Extract sine types for custom editors

For #77131

Extracts a few inline types so that extensions can use them
上级 9dae408d
...@@ -1252,24 +1252,7 @@ declare module 'vscode' { ...@@ -1252,24 +1252,7 @@ declare module 'vscode' {
/** /**
* Event triggered by extensions to signal to VS Code that an edit has occurred. * Event triggered by extensions to signal to VS Code that an edit has occurred.
*/ */
readonly onDidEdit: Event<{ readonly onDidEdit: Event<CustomDocumentEditEvent<EditType>>;
/**
* 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;
}>;
/** /**
* Apply a set of edits. * Apply a set of edits.
...@@ -1299,14 +1282,11 @@ declare module 'vscode' { ...@@ -1299,14 +1282,11 @@ declare module 'vscode' {
* Revert the file to its last saved state. * Revert the file to its last saved state.
* *
* @param document Document to revert. * @param document Document to revert.
* @param change Added or applied edits. * @param edits Added or applied edits.
* *
* @return Thenable signaling that the change has completed. * @return Thenable signaling that the change has completed.
*/ */
revert(document: CustomDocument, change: { revert(document: CustomDocument, edits: CustomDocumentRevert<EditType>): Thenable<void>;
readonly undoneEdits: readonly EditType[];
readonly appliedEdits: readonly EditType[];
}): Thenable<void>;
/** /**
* Back up the resource in its current state. * Back up the resource in its current state.
...@@ -1330,6 +1310,43 @@ declare module 'vscode' { ...@@ -1330,6 +1310,43 @@ declare module 'vscode' {
backup(document: CustomDocument, 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[];
}
/** /**
* Represents a custom document used by a `CustomEditorProvider`. * Represents a custom document used by a `CustomEditorProvider`.
* *
...@@ -1456,7 +1473,7 @@ declare module 'vscode' { ...@@ -1456,7 +1473,7 @@ declare module 'vscode' {
export function registerCustomEditorProvider( export function registerCustomEditorProvider(
viewType: string, viewType: string,
provider: CustomEditorProvider | CustomTextEditorProvider, provider: CustomEditorProvider | CustomTextEditorProvider,
webviewOptions?: WebviewPanelOptions, webviewOptions?: WebviewPanelOptions, // TODO: move this onto provider?
): Disposable; ): Disposable;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册