-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvscode.proposed.notebookEditorEdit.d.ts
53 lines (45 loc) · 2.2 KB
/
vscode.proposed.notebookEditorEdit.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
declare module 'vscode' {
// https://github.com/microsoft/vscode/issues/106744
// todo@API add NotebookEdit-type which handles all these cases?
// export class NotebookEdit {
// range: NotebookRange;
// newCells: NotebookCellData[];
// newMetadata?: NotebookDocumentMetadata;
// constructor(range: NotebookRange, newCells: NotebookCellData)
// }
// export class NotebookCellEdit {
// newMetadata?: NotebookCellMetadata;
// }
// export interface WorkspaceEdit {
// set(uri: Uri, edits: TextEdit[] | NotebookEdit[]): void
// }
export interface WorkspaceEdit {
// todo@API add NotebookEdit-type which handles all these cases?
replaceNotebookMetadata(uri: Uri, value: { [key: string]: any }): void;
replaceNotebookCells(uri: Uri, range: NotebookRange, cells: NotebookCellData[], metadata?: WorkspaceEditEntryMetadata): void;
replaceNotebookCellMetadata(uri: Uri, index: number, cellMetadata: { [key: string]: any }, metadata?: WorkspaceEditEntryMetadata): void;
}
export interface NotebookEditorEdit {
replaceMetadata(value: { [key: string]: any }): void;
replaceCells(start: number, end: number, cells: NotebookCellData[]): void;
replaceCellMetadata(index: number, metadata: { [key: string]: any }): void;
}
export interface NotebookEditor {
/**
* Perform an edit on the notebook associated with this notebook editor.
*
* The given callback-function is invoked with an {@link NotebookEditorEdit edit-builder} which must
* be used to make edits. Note that the edit-builder is only valid while the
* callback executes.
*
* @param callback A function which can create edits using an {@link NotebookEditorEdit edit-builder}.
* @return A promise that resolves with a value indicating if the edits could be applied.
*/
// @jrieken REMOVE maybe
edit(callback: (editBuilder: NotebookEditorEdit) => void): Thenable<boolean>;
}
}