-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvscode.proposed.notebookEditor.d.ts
170 lines (141 loc) · 5.5 KB
/
vscode.proposed.notebookEditor.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
/*---------------------------------------------------------------------------------------------
* 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
/**
* Represents a notebook editor that is attached to a {@link NotebookDocument notebook}.
*/
export enum NotebookEditorRevealType {
/**
* The range will be revealed with as little scrolling as possible.
*/
Default = 0,
/**
* The range will always be revealed in the center of the viewport.
*/
InCenter = 1,
/**
* If the range is outside the viewport, it will be revealed in the center of the viewport.
* Otherwise, it will be revealed with as little scrolling as possible.
*/
InCenterIfOutsideViewport = 2,
/**
* The range will always be revealed at the top of the viewport.
*/
AtTop = 3
}
/**
* Represents a notebook editor that is attached to a {@link NotebookDocument notebook}.
*/
export interface NotebookEditor {
/**
* The document associated with this notebook editor.
*/
//todo@api rename to notebook?
readonly document: NotebookDocument;
/**
* The selections on this notebook editor.
*
* The primary selection (or focused range) is `selections[0]`. When the document has no cells, the primary selection is empty `{ start: 0, end: 0 }`;
*/
selections: NotebookRange[];
/**
* The current visible ranges in the editor (vertically).
*/
readonly visibleRanges: NotebookRange[];
/**
* Scroll as indicated by `revealType` in order to reveal the given range.
*
* @param range A range.
* @param revealType The scrolling strategy for revealing `range`.
*/
revealRange(range: NotebookRange, revealType?: NotebookEditorRevealType): void;
/**
* The column in which this editor shows.
*/
readonly viewColumn?: ViewColumn;
}
export interface NotebookDocumentMetadataChangeEvent {
/**
* The {@link NotebookDocument notebook document} for which the document metadata have changed.
*/
//todo@API rename to notebook?
readonly document: NotebookDocument;
}
export interface NotebookCellsChangeData {
readonly start: number;
// todo@API end? Use NotebookCellRange instead?
readonly deletedCount: number;
// todo@API removedCells, deletedCells?
readonly deletedItems: NotebookCell[];
// todo@API addedCells, insertedCells, newCells?
readonly items: NotebookCell[];
}
export interface NotebookCellsChangeEvent {
/**
* The {@link NotebookDocument notebook document} for which the cells have changed.
*/
//todo@API rename to notebook?
readonly document: NotebookDocument;
readonly changes: ReadonlyArray<NotebookCellsChangeData>;
}
export interface NotebookCellOutputsChangeEvent {
/**
* The {@link NotebookDocument notebook document} for which the cell outputs have changed.
*/
//todo@API remove? use cell.notebook instead?
readonly document: NotebookDocument;
// NotebookCellOutputsChangeEvent.cells vs NotebookCellMetadataChangeEvent.cell
readonly cells: NotebookCell[];
}
export interface NotebookCellMetadataChangeEvent {
/**
* The {@link NotebookDocument notebook document} for which the cell metadata have changed.
*/
//todo@API remove? use cell.notebook instead?
readonly document: NotebookDocument;
// NotebookCellOutputsChangeEvent.cells vs NotebookCellMetadataChangeEvent.cell
readonly cell: NotebookCell;
}
export interface NotebookEditorSelectionChangeEvent {
/**
* The {@link NotebookEditor notebook editor} for which the selections have changed.
*/
readonly notebookEditor: NotebookEditor;
readonly selections: ReadonlyArray<NotebookRange>
}
export interface NotebookEditorVisibleRangesChangeEvent {
/**
* The {@link NotebookEditor notebook editor} for which the visible ranges have changed.
*/
readonly notebookEditor: NotebookEditor;
readonly visibleRanges: ReadonlyArray<NotebookRange>;
}
export interface NotebookDocumentShowOptions {
viewColumn?: ViewColumn;
preserveFocus?: boolean;
preview?: boolean;
selections?: NotebookRange[];
}
export namespace notebooks {
export const onDidSaveNotebookDocument: Event<NotebookDocument>;
export const onDidChangeNotebookDocumentMetadata: Event<NotebookDocumentMetadataChangeEvent>;
export const onDidChangeNotebookCells: Event<NotebookCellsChangeEvent>;
// todo@API add onDidChangeNotebookCellOutputs
export const onDidChangeCellOutputs: Event<NotebookCellOutputsChangeEvent>;
// todo@API add onDidChangeNotebookCellMetadata
export const onDidChangeCellMetadata: Event<NotebookCellMetadataChangeEvent>;
}
export namespace window {
export const visibleNotebookEditors: NotebookEditor[];
export const onDidChangeVisibleNotebookEditors: Event<NotebookEditor[]>;
export const activeNotebookEditor: NotebookEditor | undefined;
export const onDidChangeActiveNotebookEditor: Event<NotebookEditor | undefined>;
export const onDidChangeNotebookEditorSelection: Event<NotebookEditorSelectionChangeEvent>;
export const onDidChangeNotebookEditorVisibleRanges: Event<NotebookEditorVisibleRangesChangeEvent>;
export function showNotebookDocument(uri: Uri, options?: NotebookDocumentShowOptions): Thenable<NotebookEditor>;
export function showNotebookDocument(document: NotebookDocument, options?: NotebookDocumentShowOptions): Thenable<NotebookEditor>;
}
}