@codingame/monaco-vscode-notebook-service-override 25.1.2 → 26.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +2 -2
- package/package.json +3 -3
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/emptyTextEditorHint/emptyTextEditorHint.js +112 -94
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellCommands/cellCommands.js +95 -96
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellDiagnostics/cellDiagnosticEditorContrib.js +28 -19
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellDiagnostics/cellDiagnosticsActions.js +15 -9
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellDiagnostics/diagnosticCellStatusBarContrib.js +22 -17
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/contributedStatusBarItemController.js +25 -10
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/statusBarProviders.js +37 -44
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/clipboard/notebookClipboard.js +211 -115
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookBreakpoints.js +16 -18
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookCellPausing.js +5 -8
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookDebugDecorations.js +57 -49
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/editorHint/emptyCellEditorHint.js +24 -11
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/editorStatusBar/editorStatusBar.js +78 -76
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/execute/executionEditorProgress.js +14 -15
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFind.js +43 -28
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/format/formatting.js +65 -34
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/gettingStarted/notebookGettingStarted.js +19 -16
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/kernelDetection/notebookKernelDetection.js +6 -10
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/layout/layoutActions.js +15 -17
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/marker/markerProvider.js +28 -16
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/multicursor/notebookMulticursor.js +211 -170
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/multicursor/notebookSelectionHighlight.js +11 -11
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/navigation/arrow.js +158 -156
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookInlineVariables.js +109 -105
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariableContextKeys.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariables.js +28 -22
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesDataSource.js +26 -17
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesTree.js +23 -16
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesView.js +72 -40
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/outline/notebookOutline.js +233 -186
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/profile/notebookProfile.js +22 -18
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/saveParticipants/saveParticipants.js +239 -151
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/troubleshoot/layout.js +85 -86
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/undoRedo/notebookUndoRedo.js +25 -11
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/viewportWarmup/viewportWarmup.js +13 -10
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/apiActions.js +8 -5
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/editActions.js +218 -196
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/executeActions.js +258 -255
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/layoutActions.js +106 -98
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/notebookIndentationActions.js +63 -49
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/sectionActions.js +55 -64
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/variablesActions.js +21 -25
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffActions.js +149 -129
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookMultiDiffEditor.d.ts +57 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookMultiDiffEditor.js +286 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookMultiDiffEditorInput.d.ts +22 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookMultiDiffEditorInput.js +82 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebook.contribution.js +452 -363
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookAccessibilityHelp.js +44 -61
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookAccessibleView.js +9 -11
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookExtensionPoint.js +203 -207
- package/vscode/src/vs/workbench/contrib/notebook/browser/outputEditor/notebookOutputEditor.js +148 -104
- package/vscode/src/vs/workbench/contrib/notebook/browser/outputEditor/notebookOutputEditorInput.js +19 -11
- package/vscode/src/vs/workbench/contrib/notebook/browser/replEditorAccessibleView.js +9 -11
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookCellStatusBarServiceImpl.js +9 -6
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookEditorServiceImpl.js +34 -22
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionServiceImpl.js +29 -18
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionStateServiceImpl.js +70 -52
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKernelHistoryServiceImpl.js +31 -19
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKernelServiceImpl.js +78 -41
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKeymapServiceImpl.js +37 -27
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookLoggingServiceImpl.js +9 -6
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookRendererMessagingServiceImpl.js +8 -7
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookServiceImpl.js +214 -119
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookWorkerServiceImpl.js +38 -36
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/notebookOutlineDataSource.js +24 -25
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/notebookOutlineDataSourceFactory.js +2 -6
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/notebookOutlineEntryFactory.js +26 -15
- package/vscode/src/vs/workbench/contrib/notebook/common/model/cellEdit.js +35 -15
- package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookTextModel.js +468 -258
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookDiffEditorInput.d.ts +33 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookDiffEditorInput.js +113 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookEditorModelResolverServiceImpl.js +74 -58
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookOutputRenderer.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookOutputRenderer.js +7 -10
- package/vscode/src/vs/workbench/contrib/notebook/common/services/notebookCellMatching.js +72 -16
- package/vscode/src/vs/workbench/contrib/notebook/common/services/notebookWebWorker.js +70 -51
- package/vscode/src/vs/workbench/contrib/replNotebook/browser/repl.contribution.js +195 -149
- package/vscode/src/vs/workbench/contrib/replNotebook/browser/replEditorAccessibilityHelp.js +60 -81
- package/vscode/src/vs/workbench/services/workingCopy/common/abstractFileWorkingCopyManager.js +7 -12
- package/vscode/src/vs/workbench/services/workingCopy/common/fileWorkingCopyManager.js +104 -66
- package/vscode/src/vs/workbench/services/workingCopy/common/storedFileWorkingCopyManager.js +115 -77
- package/vscode/src/vs/workbench/services/workingCopy/common/untitledFileWorkingCopy.js +42 -26
- package/vscode/src/vs/workbench/services/workingCopy/common/untitledFileWorkingCopyManager.js +19 -12
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions.d.ts +0 -7
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions.js +0 -198
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/notebook.chat.contribution.d.ts +0 -8
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/notebook.chat.contribution.js +0 -333
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/notebookChatContext.d.ts +0 -2
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/notebookChatContext.js +0 -7
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/insertCellActions.d.ts +0 -13
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/insertCellActions.js +0 -261
|
@@ -28,17 +28,24 @@ import { NotebookCellTextModel } from '@codingame/monaco-vscode-api/vscode/vs/wo
|
|
|
28
28
|
var NotebookTextModel_1;
|
|
29
29
|
class StackOperation {
|
|
30
30
|
get code() {
|
|
31
|
-
return this._operations.length === 1 ? this._operations[0].code :
|
|
31
|
+
return this._operations.length === 1 ? this._operations[0].code : "undoredo.notebooks.stackOperation";
|
|
32
32
|
}
|
|
33
33
|
get label() {
|
|
34
|
-
return this._operations.length === 1 ? this._operations[0].label :
|
|
35
|
-
}
|
|
36
|
-
constructor(
|
|
34
|
+
return this._operations.length === 1 ? this._operations[0].label : "edit";
|
|
35
|
+
}
|
|
36
|
+
constructor(
|
|
37
|
+
textModel,
|
|
38
|
+
undoRedoGroup,
|
|
39
|
+
_pauseableEmitter,
|
|
40
|
+
_postUndoRedo,
|
|
41
|
+
selectionState,
|
|
42
|
+
beginAlternativeVersionId
|
|
43
|
+
) {
|
|
37
44
|
this.textModel = textModel;
|
|
38
45
|
this.undoRedoGroup = undoRedoGroup;
|
|
39
46
|
this._pauseableEmitter = _pauseableEmitter;
|
|
40
47
|
this._postUndoRedo = _postUndoRedo;
|
|
41
|
-
this.tag =
|
|
48
|
+
this.tag = "notebookUndoRedoElement";
|
|
42
49
|
this._operations = [];
|
|
43
50
|
this._beginSelectionState = undefined;
|
|
44
51
|
this._resultSelectionState = undefined;
|
|
@@ -78,8 +85,7 @@ class StackOperation {
|
|
|
78
85
|
versionId: this.textModel.versionId,
|
|
79
86
|
endSelectionState: this._beginSelectionState
|
|
80
87
|
});
|
|
81
|
-
}
|
|
82
|
-
finally {
|
|
88
|
+
} finally {
|
|
83
89
|
this._pauseableEmitter.resume();
|
|
84
90
|
}
|
|
85
91
|
}
|
|
@@ -96,8 +102,7 @@ class StackOperation {
|
|
|
96
102
|
versionId: this.textModel.versionId,
|
|
97
103
|
endSelectionState: this._resultSelectionState
|
|
98
104
|
});
|
|
99
|
-
}
|
|
100
|
-
finally {
|
|
105
|
+
} finally {
|
|
101
106
|
this._pauseableEmitter.resume();
|
|
102
107
|
}
|
|
103
108
|
}
|
|
@@ -131,19 +136,25 @@ class NotebookOperationManager {
|
|
|
131
136
|
this._pauseableEmitter,
|
|
132
137
|
this._postUndoRedo,
|
|
133
138
|
beginSelectionState,
|
|
134
|
-
alternativeVersionId ||
|
|
139
|
+
alternativeVersionId || ""
|
|
135
140
|
));
|
|
136
141
|
}
|
|
137
142
|
appendPreviousOperation() {
|
|
138
143
|
const previous = this._undoService.getLastElement(this._textModel.uri);
|
|
139
|
-
if (previous && previous.tag ===
|
|
144
|
+
if (previous && previous.tag === "notebookUndoRedoElement") {
|
|
140
145
|
this._pendingStackOperation = previous;
|
|
141
146
|
this._isAppending = true;
|
|
142
147
|
return true;
|
|
143
148
|
}
|
|
144
149
|
return false;
|
|
145
150
|
}
|
|
146
|
-
pushEditOperation(
|
|
151
|
+
pushEditOperation(
|
|
152
|
+
element,
|
|
153
|
+
beginSelectionState,
|
|
154
|
+
resultSelectionState,
|
|
155
|
+
alternativeVersionId,
|
|
156
|
+
undoRedoGroup
|
|
157
|
+
) {
|
|
147
158
|
const pendingStackOperation = this._getOrCreateEditStackElement(beginSelectionState, undoRedoGroup, alternativeVersionId);
|
|
148
159
|
pendingStackOperation.pushEditOperation(element, beginSelectionState, resultSelectionState, alternativeVersionId);
|
|
149
160
|
}
|
|
@@ -179,7 +190,19 @@ let NotebookTextModel = NotebookTextModel_1 = class NotebookTextModel extends Di
|
|
|
179
190
|
get notebookType() {
|
|
180
191
|
return this.viewType;
|
|
181
192
|
}
|
|
182
|
-
constructor(
|
|
193
|
+
constructor(
|
|
194
|
+
viewType,
|
|
195
|
+
uri,
|
|
196
|
+
cells,
|
|
197
|
+
metadata,
|
|
198
|
+
options,
|
|
199
|
+
_undoService,
|
|
200
|
+
_modelService,
|
|
201
|
+
_languageService,
|
|
202
|
+
_languageDetectionService,
|
|
203
|
+
_notebookExecutionStateService,
|
|
204
|
+
_notebookLoggingService
|
|
205
|
+
) {
|
|
183
206
|
super();
|
|
184
207
|
this.viewType = viewType;
|
|
185
208
|
this.uri = uri;
|
|
@@ -200,15 +223,20 @@ let NotebookTextModel = NotebookTextModel_1 = class NotebookTextModel extends Di
|
|
|
200
223
|
this._cellListeners = ( new Map());
|
|
201
224
|
this._cells = [];
|
|
202
225
|
this.metadata = {};
|
|
203
|
-
this.transientOptions = {
|
|
226
|
+
this.transientOptions = {
|
|
227
|
+
transientCellMetadata: {},
|
|
228
|
+
transientDocumentMetadata: {},
|
|
229
|
+
transientOutputs: false,
|
|
230
|
+
cellContentMetadata: {}
|
|
231
|
+
};
|
|
204
232
|
this._versionId = 0;
|
|
205
233
|
this._notebookSpecificAlternativeId = 0;
|
|
206
|
-
this._alternativeVersionId =
|
|
234
|
+
this._alternativeVersionId = "1";
|
|
207
235
|
this.newCellsFromLastEdit = ( new Set());
|
|
208
236
|
this.transientOptions = options;
|
|
209
237
|
this.metadata = metadata;
|
|
210
238
|
this._initialize(cells);
|
|
211
|
-
const maybeUpdateCellTextModel =
|
|
239
|
+
const maybeUpdateCellTextModel = textModel => {
|
|
212
240
|
if (textModel.uri.scheme === Schemas.vscodeNotebookCell && textModel instanceof TextModel) {
|
|
213
241
|
const cellUri = CellUri.parse(textModel.uri);
|
|
214
242
|
if (cellUri && isEqual(cellUri.notebook, this.uri)) {
|
|
@@ -224,7 +252,7 @@ let NotebookTextModel = NotebookTextModel_1 = class NotebookTextModel extends Di
|
|
|
224
252
|
};
|
|
225
253
|
this._register(_modelService.onModelAdded(e => maybeUpdateCellTextModel(e)));
|
|
226
254
|
this._pauseableEmitter = this._register(( new NotebookEventEmitter({
|
|
227
|
-
merge:
|
|
255
|
+
merge: events => {
|
|
228
256
|
const first = events[0];
|
|
229
257
|
const rawEvents = first.rawEvents;
|
|
230
258
|
let versionId = first.versionId;
|
|
@@ -236,7 +264,12 @@ let NotebookTextModel = NotebookTextModel_1 = class NotebookTextModel extends Di
|
|
|
236
264
|
endSelectionState = events[i].endSelectionState !== undefined ? events[i].endSelectionState : endSelectionState;
|
|
237
265
|
synchronous = events[i].synchronous !== undefined ? events[i].synchronous : synchronous;
|
|
238
266
|
}
|
|
239
|
-
return {
|
|
267
|
+
return {
|
|
268
|
+
rawEvents,
|
|
269
|
+
versionId,
|
|
270
|
+
endSelectionState,
|
|
271
|
+
synchronous
|
|
272
|
+
};
|
|
240
273
|
}
|
|
241
274
|
})));
|
|
242
275
|
this._register(this._pauseableEmitter.event(e => {
|
|
@@ -244,16 +277,11 @@ let NotebookTextModel = NotebookTextModel_1 = class NotebookTextModel extends Di
|
|
|
244
277
|
this._onDidChangeContent.fire(e);
|
|
245
278
|
}
|
|
246
279
|
}));
|
|
247
|
-
this._operationManager = ( new NotebookOperationManager(
|
|
248
|
-
this
|
|
249
|
-
this.
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
this._increaseVersionId(true);
|
|
253
|
-
this._overwriteAlternativeVersionId(alternativeVersionId);
|
|
254
|
-
}
|
|
255
|
-
));
|
|
256
|
-
this._notebookLoggingService.trace('notebookTextModel', `Initialized notebook text model for ${( uri.toString())}`);
|
|
280
|
+
this._operationManager = ( new NotebookOperationManager(this, this._undoService, this._pauseableEmitter, alternativeVersionId => {
|
|
281
|
+
this._increaseVersionId(true);
|
|
282
|
+
this._overwriteAlternativeVersionId(alternativeVersionId);
|
|
283
|
+
}));
|
|
284
|
+
this._notebookLoggingService.trace("notebookTextModel", `Initialized notebook text model for ${( uri.toString())}`);
|
|
257
285
|
}
|
|
258
286
|
setCellCollapseDefault(collapseConfig) {
|
|
259
287
|
this._defaultCollapseConfig = collapseConfig;
|
|
@@ -278,7 +306,7 @@ let NotebookTextModel = NotebookTextModel_1 = class NotebookTextModel extends Di
|
|
|
278
306
|
));
|
|
279
307
|
}));
|
|
280
308
|
for (let i = 0; i < mainCells.length; i++) {
|
|
281
|
-
const dirtyStateListener = mainCells[i].onDidChangeContent(
|
|
309
|
+
const dirtyStateListener = mainCells[i].onDidChangeContent(e => {
|
|
282
310
|
this._bindCellContentHandler(mainCells[i], e);
|
|
283
311
|
});
|
|
284
312
|
this._cellListeners.set(mainCells[i].handle, dirtyStateListener);
|
|
@@ -288,7 +316,10 @@ let NotebookTextModel = NotebookTextModel_1 = class NotebookTextModel extends Di
|
|
|
288
316
|
this._alternativeVersionId = this._generateAlternativeId();
|
|
289
317
|
if (triggerDirty) {
|
|
290
318
|
this._pauseableEmitter.fire({
|
|
291
|
-
rawEvents: [{
|
|
319
|
+
rawEvents: [{
|
|
320
|
+
kind: NotebookCellsChangeType.Unknown,
|
|
321
|
+
transient: false
|
|
322
|
+
}],
|
|
292
323
|
versionId: this.versionId,
|
|
293
324
|
synchronous: true,
|
|
294
325
|
endSelectionState: undefined
|
|
@@ -296,46 +327,64 @@ let NotebookTextModel = NotebookTextModel_1 = class NotebookTextModel extends Di
|
|
|
296
327
|
}
|
|
297
328
|
}
|
|
298
329
|
_bindCellContentHandler(cell, e) {
|
|
299
|
-
this._increaseVersionId(e ===
|
|
330
|
+
this._increaseVersionId(e === "content" || (typeof e === "object" && e.type === "model"));
|
|
300
331
|
switch (e) {
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
332
|
+
case "content":
|
|
333
|
+
this._pauseableEmitter.fire({
|
|
334
|
+
rawEvents: [{
|
|
335
|
+
kind: NotebookCellsChangeType.ChangeCellContent,
|
|
336
|
+
index: this._getCellIndexByHandle(cell.handle),
|
|
337
|
+
transient: false
|
|
338
|
+
}],
|
|
339
|
+
versionId: this.versionId,
|
|
340
|
+
synchronous: true,
|
|
341
|
+
endSelectionState: undefined
|
|
342
|
+
});
|
|
343
|
+
break;
|
|
344
|
+
case "language":
|
|
345
|
+
this._pauseableEmitter.fire({
|
|
346
|
+
rawEvents: [{
|
|
347
|
+
kind: NotebookCellsChangeType.ChangeCellLanguage,
|
|
348
|
+
index: this._getCellIndexByHandle(cell.handle),
|
|
349
|
+
language: cell.language,
|
|
350
|
+
transient: false
|
|
351
|
+
}],
|
|
352
|
+
versionId: this.versionId,
|
|
353
|
+
synchronous: true,
|
|
354
|
+
endSelectionState: undefined
|
|
355
|
+
});
|
|
356
|
+
break;
|
|
357
|
+
case "mime":
|
|
358
|
+
this._pauseableEmitter.fire({
|
|
359
|
+
rawEvents: [{
|
|
360
|
+
kind: NotebookCellsChangeType.ChangeCellMime,
|
|
361
|
+
index: this._getCellIndexByHandle(cell.handle),
|
|
362
|
+
mime: cell.mime,
|
|
363
|
+
transient: false
|
|
364
|
+
}],
|
|
365
|
+
versionId: this.versionId,
|
|
366
|
+
synchronous: true,
|
|
367
|
+
endSelectionState: undefined
|
|
368
|
+
});
|
|
369
|
+
break;
|
|
370
|
+
default:
|
|
371
|
+
if (typeof e === "object" && e.type === "model") {
|
|
318
372
|
this._pauseableEmitter.fire({
|
|
319
|
-
rawEvents: [{
|
|
373
|
+
rawEvents: [{
|
|
374
|
+
kind: NotebookCellsChangeType.ChangeCellContent,
|
|
375
|
+
index: this._getCellIndexByHandle(cell.handle),
|
|
376
|
+
transient: false
|
|
377
|
+
}],
|
|
320
378
|
versionId: this.versionId,
|
|
321
379
|
synchronous: true,
|
|
322
380
|
endSelectionState: undefined
|
|
323
381
|
});
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
if (typeof e === 'object' && e.type === 'model') {
|
|
327
|
-
this._pauseableEmitter.fire({
|
|
328
|
-
rawEvents: [{ kind: NotebookCellsChangeType.ChangeCellContent, index: this._getCellIndexByHandle(cell.handle), transient: false }],
|
|
329
|
-
versionId: this.versionId,
|
|
330
|
-
synchronous: true,
|
|
331
|
-
endSelectionState: undefined
|
|
332
|
-
});
|
|
333
|
-
}
|
|
334
|
-
break;
|
|
382
|
+
}
|
|
383
|
+
break;
|
|
335
384
|
}
|
|
336
385
|
}
|
|
337
386
|
_generateAlternativeId() {
|
|
338
|
-
return `${this._notebookSpecificAlternativeId}_` + ( this.cells.map(cell => cell.handle +
|
|
387
|
+
return `${this._notebookSpecificAlternativeId}_` + ( this.cells.map(cell => cell.handle + "," + cell.alternativeId)).join(";");
|
|
339
388
|
}
|
|
340
389
|
dispose() {
|
|
341
390
|
if (this._isDisposed) {
|
|
@@ -350,18 +399,22 @@ let NotebookTextModel = NotebookTextModel_1 = class NotebookTextModel extends Di
|
|
|
350
399
|
this._cells = [];
|
|
351
400
|
super.dispose();
|
|
352
401
|
}
|
|
353
|
-
pushStackElement() {
|
|
354
|
-
}
|
|
402
|
+
pushStackElement() {}
|
|
355
403
|
_getCellIndexByHandle(handle) {
|
|
356
404
|
return this.cells.findIndex(c => c.handle === handle);
|
|
357
405
|
}
|
|
358
406
|
_getCellIndexWithOutputIdHandleFromEdits(outputId, rawEdits) {
|
|
359
|
-
const edit = rawEdits.find(e => hasKey(e, {
|
|
407
|
+
const edit = rawEdits.find(e => hasKey(e, {
|
|
408
|
+
outputs: true
|
|
409
|
+
}) && ( e.outputs.some(o => o.outputId === outputId)));
|
|
360
410
|
if (edit) {
|
|
361
|
-
if (hasKey(edit, {
|
|
411
|
+
if (hasKey(edit, {
|
|
412
|
+
index: true
|
|
413
|
+
})) {
|
|
362
414
|
return edit.index;
|
|
363
|
-
}
|
|
364
|
-
|
|
415
|
+
} else if (hasKey(edit, {
|
|
416
|
+
handle: true
|
|
417
|
+
})) {
|
|
365
418
|
const cellIndex = this._getCellIndexByHandle(edit.handle);
|
|
366
419
|
this._assertIndex(cellIndex);
|
|
367
420
|
return cellIndex;
|
|
@@ -377,16 +430,16 @@ let NotebookTextModel = NotebookTextModel_1 = class NotebookTextModel extends Di
|
|
|
377
430
|
const executions = this._notebookExecutionStateService.getCellExecutionsForNotebook(this.uri);
|
|
378
431
|
const executingCellHandles = ( executions.filter(exe => exe.state === NotebookCellExecutionState.Executing).map(exe => exe.cellHandle));
|
|
379
432
|
const edits = NotebookTextModel_1.computeEdits(this, cells, executingCellHandles);
|
|
380
|
-
this.applyEdits([
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
], true, undefined, () => undefined, undefined, false);
|
|
433
|
+
this.applyEdits([...edits, {
|
|
434
|
+
editType: CellEditType.DocumentMetadata,
|
|
435
|
+
metadata
|
|
436
|
+
}], true, undefined, () => undefined, undefined, false);
|
|
384
437
|
}
|
|
385
438
|
createSnapshot(options) {
|
|
386
439
|
const transientOptions = options.transientOptions ?? this.transientOptions;
|
|
387
440
|
const data = {
|
|
388
441
|
metadata: filter(this.metadata, key => !transientOptions.transientDocumentMetadata[key]),
|
|
389
|
-
cells: []
|
|
442
|
+
cells: []
|
|
390
443
|
};
|
|
391
444
|
let outputSize = 0;
|
|
392
445
|
for (const cell of this.cells) {
|
|
@@ -405,7 +458,7 @@ let NotebookTextModel = NotebookTextModel_1 = class NotebookTextModel extends Di
|
|
|
405
458
|
});
|
|
406
459
|
});
|
|
407
460
|
if (outputSize > options.outputSizeLimit) {
|
|
408
|
-
throw ( new Error(
|
|
461
|
+
throw ( new Error("Notebook too large to backup"));
|
|
409
462
|
}
|
|
410
463
|
}
|
|
411
464
|
cellData.outputs = !transientOptions.transientOutputs ? cell.outputs : [];
|
|
@@ -415,11 +468,15 @@ let NotebookTextModel = NotebookTextModel_1 = class NotebookTextModel extends Di
|
|
|
415
468
|
return data;
|
|
416
469
|
}
|
|
417
470
|
restoreSnapshot(snapshot, transientOptions) {
|
|
418
|
-
this.reset(
|
|
471
|
+
this.reset(
|
|
472
|
+
snapshot.cells,
|
|
473
|
+
snapshot.metadata,
|
|
474
|
+
transientOptions ?? this.transientOptions
|
|
475
|
+
);
|
|
419
476
|
}
|
|
420
477
|
static computeEdits(model, cells, executingHandles = []) {
|
|
421
478
|
const edits = [];
|
|
422
|
-
const isExecuting =
|
|
479
|
+
const isExecuting = cell => executingHandles.includes(cell.handle);
|
|
423
480
|
const commonPrefix = this._commonPrefix(model.cells, model.cells.length, 0, cells, cells.length, 0, isExecuting);
|
|
424
481
|
if (commonPrefix > 0) {
|
|
425
482
|
for (let i = 0; i < commonPrefix; i++) {
|
|
@@ -433,15 +490,36 @@ let NotebookTextModel = NotebookTextModel_1 = class NotebookTextModel extends Di
|
|
|
433
490
|
if (model.cells.length === cells.length && commonPrefix === model.cells.length) {
|
|
434
491
|
return edits;
|
|
435
492
|
}
|
|
436
|
-
const commonSuffix = this._commonSuffix(
|
|
493
|
+
const commonSuffix = this._commonSuffix(
|
|
494
|
+
model.cells,
|
|
495
|
+
model.cells.length - commonPrefix,
|
|
496
|
+
commonPrefix,
|
|
497
|
+
cells,
|
|
498
|
+
cells.length - commonPrefix,
|
|
499
|
+
commonPrefix,
|
|
500
|
+
isExecuting
|
|
501
|
+
);
|
|
437
502
|
if (commonSuffix > 0) {
|
|
438
|
-
edits.push({
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
503
|
+
edits.push({
|
|
504
|
+
editType: CellEditType.Replace,
|
|
505
|
+
index: commonPrefix,
|
|
506
|
+
count: model.cells.length - commonPrefix - commonSuffix,
|
|
507
|
+
cells: cells.slice(commonPrefix, cells.length - commonSuffix)
|
|
508
|
+
});
|
|
509
|
+
} else if (commonPrefix > 0) {
|
|
510
|
+
edits.push({
|
|
511
|
+
editType: CellEditType.Replace,
|
|
512
|
+
index: commonPrefix,
|
|
513
|
+
count: model.cells.length - commonPrefix,
|
|
514
|
+
cells: cells.slice(commonPrefix)
|
|
515
|
+
});
|
|
516
|
+
} else {
|
|
517
|
+
edits.push({
|
|
518
|
+
editType: CellEditType.Replace,
|
|
519
|
+
index: 0,
|
|
520
|
+
count: model.cells.length,
|
|
521
|
+
cells
|
|
522
|
+
});
|
|
445
523
|
}
|
|
446
524
|
if (commonSuffix > 0) {
|
|
447
525
|
for (let i = commonSuffix; i > 0; i--) {
|
|
@@ -449,21 +527,23 @@ let NotebookTextModel = NotebookTextModel_1 = class NotebookTextModel extends Di
|
|
|
449
527
|
editType: CellEditType.Metadata,
|
|
450
528
|
index: model.cells.length - i,
|
|
451
529
|
metadata: cells[cells.length - i].metadata ?? {}
|
|
452
|
-
}, ...this._computeOutputEdit(
|
|
530
|
+
}, ...this._computeOutputEdit(
|
|
531
|
+
model.cells.length - i,
|
|
532
|
+
model.cells[model.cells.length - i].outputs,
|
|
533
|
+
cells[cells.length - i].outputs
|
|
534
|
+
));
|
|
453
535
|
}
|
|
454
536
|
}
|
|
455
537
|
return edits;
|
|
456
538
|
}
|
|
457
539
|
static _computeOutputEdit(index, a, b) {
|
|
458
540
|
if (a.length !== b.length) {
|
|
459
|
-
return [
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
}
|
|
466
|
-
];
|
|
541
|
+
return [{
|
|
542
|
+
editType: CellEditType.Output,
|
|
543
|
+
index: index,
|
|
544
|
+
outputs: b,
|
|
545
|
+
append: false
|
|
546
|
+
}];
|
|
467
547
|
}
|
|
468
548
|
if (a.length === 0) {
|
|
469
549
|
return [];
|
|
@@ -501,17 +581,28 @@ let NotebookTextModel = NotebookTextModel_1 = class NotebookTextModel extends Di
|
|
|
501
581
|
if (edit.editType !== CellEditType.Metadata && edit.editType !== CellEditType.PartialMetadata) {
|
|
502
582
|
return false;
|
|
503
583
|
}
|
|
504
|
-
if (hasKey(edit, {
|
|
584
|
+
if (hasKey(edit, {
|
|
585
|
+
index: true
|
|
586
|
+
}) && !( this.newCellsFromLastEdit.has(this.cells[edit.index].handle))) {
|
|
505
587
|
return false;
|
|
506
588
|
}
|
|
507
|
-
if (hasKey(edit, {
|
|
589
|
+
if (hasKey(edit, {
|
|
590
|
+
handle: true
|
|
591
|
+
}) && !( this.newCellsFromLastEdit.has(edit.handle))) {
|
|
508
592
|
return false;
|
|
509
593
|
}
|
|
510
594
|
}
|
|
511
595
|
return true;
|
|
512
596
|
}
|
|
513
|
-
applyEdits(
|
|
514
|
-
|
|
597
|
+
applyEdits(
|
|
598
|
+
rawEdits,
|
|
599
|
+
synchronous,
|
|
600
|
+
beginSelectionState,
|
|
601
|
+
endSelectionsComputer,
|
|
602
|
+
undoRedoGroup,
|
|
603
|
+
computeUndoRedo
|
|
604
|
+
) {
|
|
605
|
+
this._notebookLoggingService.trace("textModelEdits", `Begin applying ${rawEdits.length} raw edits`);
|
|
515
606
|
this._pauseableEmitter.pause();
|
|
516
607
|
try {
|
|
517
608
|
this._operationManager.pushStackElement(this._alternativeVersionId, undefined);
|
|
@@ -519,43 +610,50 @@ let NotebookTextModel = NotebookTextModel_1 = class NotebookTextModel extends Di
|
|
|
519
610
|
if (!this._operationManager.appendPreviousOperation()) {
|
|
520
611
|
computeUndoRedo = false;
|
|
521
612
|
}
|
|
522
|
-
}
|
|
523
|
-
else if (computeUndoRedo) {
|
|
613
|
+
} else if (computeUndoRedo) {
|
|
524
614
|
this.newCellsFromLastEdit.clear();
|
|
525
615
|
}
|
|
526
616
|
try {
|
|
527
617
|
this._doApplyEdits(rawEdits, synchronous, computeUndoRedo, beginSelectionState, undoRedoGroup);
|
|
528
618
|
return true;
|
|
529
|
-
}
|
|
530
|
-
|
|
531
|
-
this._notebookLoggingService.error('textModelEdits', `Error while applying edits: ${err}`);
|
|
619
|
+
} catch (err) {
|
|
620
|
+
this._notebookLoggingService.error("textModelEdits", `Error while applying edits: ${err}`);
|
|
532
621
|
throw err;
|
|
533
|
-
}
|
|
534
|
-
finally {
|
|
622
|
+
} finally {
|
|
535
623
|
if (!this._pauseableEmitter.isEmpty) {
|
|
536
624
|
const endSelections = endSelectionsComputer();
|
|
537
|
-
this._increaseVersionId(
|
|
625
|
+
this._increaseVersionId(
|
|
626
|
+
this._operationManager.isUndoStackEmpty() && !this._pauseableEmitter.isDirtyEvent()
|
|
627
|
+
);
|
|
538
628
|
this._operationManager.pushStackElement(this._alternativeVersionId, endSelections);
|
|
539
|
-
this._pauseableEmitter.fire({
|
|
540
|
-
|
|
629
|
+
this._pauseableEmitter.fire({
|
|
630
|
+
rawEvents: [],
|
|
631
|
+
versionId: this.versionId,
|
|
632
|
+
synchronous: synchronous,
|
|
633
|
+
endSelectionState: endSelections
|
|
634
|
+
});
|
|
635
|
+
this._notebookLoggingService.trace("textModelEdits", `End applying ${rawEdits.length} raw edits`);
|
|
541
636
|
}
|
|
542
637
|
}
|
|
543
|
-
}
|
|
544
|
-
finally {
|
|
638
|
+
} finally {
|
|
545
639
|
this._pauseableEmitter.resume();
|
|
546
640
|
}
|
|
547
641
|
}
|
|
548
642
|
_doApplyEdits(rawEdits, synchronous, computeUndoRedo, beginSelectionState, undoRedoGroup) {
|
|
549
643
|
const editsWithDetails = ( rawEdits.map((edit, index) => {
|
|
550
644
|
let cellIndex = -1;
|
|
551
|
-
if (hasKey(edit, {
|
|
645
|
+
if (hasKey(edit, {
|
|
646
|
+
index: true
|
|
647
|
+
})) {
|
|
552
648
|
cellIndex = edit.index;
|
|
553
|
-
}
|
|
554
|
-
|
|
649
|
+
} else if (hasKey(edit, {
|
|
650
|
+
handle: true
|
|
651
|
+
})) {
|
|
555
652
|
cellIndex = this._getCellIndexByHandle(edit.handle);
|
|
556
653
|
this._assertIndex(cellIndex);
|
|
557
|
-
}
|
|
558
|
-
|
|
654
|
+
} else if (hasKey(edit, {
|
|
655
|
+
outputId: true
|
|
656
|
+
})) {
|
|
559
657
|
cellIndex = this._getCellIndexWithOutputIdHandle(edit.outputId);
|
|
560
658
|
if (this._indexIsInvalid(cellIndex)) {
|
|
561
659
|
cellIndex = this._getCellIndexWithOutputIdHandleFromEdits(edit.outputId, rawEdits.slice(0, index));
|
|
@@ -563,21 +661,17 @@ let NotebookTextModel = NotebookTextModel_1 = class NotebookTextModel extends Di
|
|
|
563
661
|
if (this._indexIsInvalid(cellIndex)) {
|
|
564
662
|
return null;
|
|
565
663
|
}
|
|
566
|
-
}
|
|
567
|
-
|
|
568
|
-
throw ( new Error('Invalid cell edit: ' + JSON.stringify(edit)));
|
|
664
|
+
} else if (edit.editType !== CellEditType.DocumentMetadata) {
|
|
665
|
+
throw ( new Error("Invalid cell edit: " + JSON.stringify(edit)));
|
|
569
666
|
}
|
|
570
667
|
return {
|
|
571
668
|
edit,
|
|
572
669
|
cellIndex,
|
|
573
|
-
end: (edit.editType === CellEditType.DocumentMetadata)
|
|
574
|
-
? undefined
|
|
575
|
-
: (edit.editType === CellEditType.Replace ? edit.index + edit.count : cellIndex),
|
|
670
|
+
end: (edit.editType === CellEditType.DocumentMetadata) ? undefined : (edit.editType === CellEditType.Replace ? edit.index + edit.count : cellIndex),
|
|
576
671
|
originalIndex: index
|
|
577
672
|
};
|
|
578
673
|
})).filter(isDefined);
|
|
579
|
-
const edits = ( this._mergeCellEdits(editsWithDetails)
|
|
580
|
-
.sort((a, b) => {
|
|
674
|
+
const edits = ( this._mergeCellEdits(editsWithDetails).sort((a, b) => {
|
|
581
675
|
if (a.end === undefined) {
|
|
582
676
|
return -1;
|
|
583
677
|
}
|
|
@@ -588,14 +682,12 @@ let NotebookTextModel = NotebookTextModel_1 = class NotebookTextModel extends Di
|
|
|
588
682
|
}).reduce((prev, curr) => {
|
|
589
683
|
if (!prev.length) {
|
|
590
684
|
prev.push([curr]);
|
|
591
|
-
}
|
|
592
|
-
else {
|
|
685
|
+
} else {
|
|
593
686
|
const last = prev[prev.length - 1];
|
|
594
687
|
const index = last[0].cellIndex;
|
|
595
688
|
if (curr.cellIndex === index) {
|
|
596
689
|
last.push(curr);
|
|
597
|
-
}
|
|
598
|
-
else {
|
|
690
|
+
} else {
|
|
599
691
|
prev.push([curr]);
|
|
600
692
|
}
|
|
601
693
|
}
|
|
@@ -606,64 +698,104 @@ let NotebookTextModel = NotebookTextModel_1 = class NotebookTextModel extends Di
|
|
|
606
698
|
editsOnSameIndex.forEach(edit => {
|
|
607
699
|
if (edit.edit.editType === CellEditType.Replace) {
|
|
608
700
|
replaceEdits.push(edit);
|
|
609
|
-
}
|
|
610
|
-
else {
|
|
701
|
+
} else {
|
|
611
702
|
otherEdits.push(edit);
|
|
612
703
|
}
|
|
613
704
|
});
|
|
614
705
|
return [...otherEdits.reverse(), ...replaceEdits];
|
|
615
706
|
}));
|
|
616
707
|
const flattenEdits = edits.flat();
|
|
617
|
-
for (const {
|
|
708
|
+
for (const {
|
|
709
|
+
edit,
|
|
710
|
+
cellIndex
|
|
711
|
+
} of flattenEdits) {
|
|
618
712
|
switch (edit.editType) {
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
713
|
+
case CellEditType.Replace:
|
|
714
|
+
this._replaceCells(
|
|
715
|
+
edit.index,
|
|
716
|
+
edit.count,
|
|
717
|
+
edit.cells,
|
|
718
|
+
synchronous,
|
|
719
|
+
computeUndoRedo,
|
|
720
|
+
beginSelectionState,
|
|
721
|
+
undoRedoGroup
|
|
722
|
+
);
|
|
723
|
+
break;
|
|
724
|
+
case CellEditType.Output:
|
|
725
|
+
{
|
|
623
726
|
this._assertIndex(cellIndex);
|
|
624
727
|
const cell = this._cells[cellIndex];
|
|
625
728
|
if (edit.append) {
|
|
626
|
-
this._spliceNotebookCellOutputs(cell, {
|
|
627
|
-
|
|
628
|
-
|
|
729
|
+
this._spliceNotebookCellOutputs(cell, {
|
|
730
|
+
start: cell.outputs.length,
|
|
731
|
+
deleteCount: 0,
|
|
732
|
+
newOutputs: ( edit.outputs.map(op => ( new NotebookCellOutputTextModel(op))))
|
|
733
|
+
}, true, computeUndoRedo);
|
|
734
|
+
} else {
|
|
629
735
|
this._spliceNotebookCellOutputs2(cell, edit.outputs, computeUndoRedo);
|
|
630
736
|
}
|
|
631
737
|
break;
|
|
632
738
|
}
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
this._assertIndex(cellIndex);
|
|
636
|
-
const cell = this._cells[cellIndex];
|
|
637
|
-
if (edit.append) {
|
|
638
|
-
this._appendNotebookCellOutputItems(cell, edit.outputId, edit.items);
|
|
639
|
-
}
|
|
640
|
-
else {
|
|
641
|
-
this._replaceNotebookCellOutputItems(cell, edit.outputId, edit.items);
|
|
642
|
-
}
|
|
643
|
-
}
|
|
644
|
-
break;
|
|
645
|
-
case CellEditType.Metadata:
|
|
646
|
-
this._assertIndex(edit.index);
|
|
647
|
-
this._changeCellMetadata(this._cells[edit.index], edit.metadata, computeUndoRedo, beginSelectionState, undoRedoGroup);
|
|
648
|
-
break;
|
|
649
|
-
case CellEditType.PartialMetadata:
|
|
650
|
-
this._assertIndex(cellIndex);
|
|
651
|
-
this._changeCellMetadataPartial(this._cells[cellIndex], edit.metadata, computeUndoRedo, beginSelectionState, undoRedoGroup);
|
|
652
|
-
break;
|
|
653
|
-
case CellEditType.PartialInternalMetadata:
|
|
739
|
+
case CellEditType.OutputItems:
|
|
740
|
+
{
|
|
654
741
|
this._assertIndex(cellIndex);
|
|
655
|
-
this.
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
742
|
+
const cell = this._cells[cellIndex];
|
|
743
|
+
if (edit.append) {
|
|
744
|
+
this._appendNotebookCellOutputItems(cell, edit.outputId, edit.items);
|
|
745
|
+
} else {
|
|
746
|
+
this._replaceNotebookCellOutputItems(cell, edit.outputId, edit.items);
|
|
747
|
+
}
|
|
748
|
+
}
|
|
749
|
+
break;
|
|
750
|
+
case CellEditType.Metadata:
|
|
751
|
+
this._assertIndex(edit.index);
|
|
752
|
+
this._changeCellMetadata(
|
|
753
|
+
this._cells[edit.index],
|
|
754
|
+
edit.metadata,
|
|
755
|
+
computeUndoRedo,
|
|
756
|
+
beginSelectionState,
|
|
757
|
+
undoRedoGroup
|
|
758
|
+
);
|
|
759
|
+
break;
|
|
760
|
+
case CellEditType.PartialMetadata:
|
|
761
|
+
this._assertIndex(cellIndex);
|
|
762
|
+
this._changeCellMetadataPartial(
|
|
763
|
+
this._cells[cellIndex],
|
|
764
|
+
edit.metadata,
|
|
765
|
+
computeUndoRedo,
|
|
766
|
+
beginSelectionState,
|
|
767
|
+
undoRedoGroup
|
|
768
|
+
);
|
|
769
|
+
break;
|
|
770
|
+
case CellEditType.PartialInternalMetadata:
|
|
771
|
+
this._assertIndex(cellIndex);
|
|
772
|
+
this._changeCellInternalMetadataPartial(this._cells[cellIndex], edit.internalMetadata);
|
|
773
|
+
break;
|
|
774
|
+
case CellEditType.CellLanguage:
|
|
775
|
+
this._assertIndex(edit.index);
|
|
776
|
+
this._changeCellLanguage(
|
|
777
|
+
this._cells[edit.index],
|
|
778
|
+
edit.language,
|
|
779
|
+
computeUndoRedo,
|
|
780
|
+
beginSelectionState,
|
|
781
|
+
undoRedoGroup
|
|
782
|
+
);
|
|
783
|
+
break;
|
|
784
|
+
case CellEditType.DocumentMetadata:
|
|
785
|
+
this._updateNotebookCellMetadata(edit.metadata, computeUndoRedo, beginSelectionState, undoRedoGroup);
|
|
786
|
+
break;
|
|
787
|
+
case CellEditType.Move:
|
|
788
|
+
this._moveCellToIdx(
|
|
789
|
+
edit.index,
|
|
790
|
+
edit.length,
|
|
791
|
+
edit.newIdx,
|
|
792
|
+
synchronous,
|
|
793
|
+
computeUndoRedo,
|
|
794
|
+
beginSelectionState,
|
|
795
|
+
undefined,
|
|
796
|
+
undoRedoGroup
|
|
797
|
+
);
|
|
798
|
+
break;
|
|
667
799
|
}
|
|
668
800
|
}
|
|
669
801
|
}
|
|
@@ -672,33 +804,30 @@ let NotebookTextModel = NotebookTextModel_1 = class NotebookTextModel extends Di
|
|
|
672
804
|
rawEdits.forEach(edit => {
|
|
673
805
|
if (mergedEdits.length) {
|
|
674
806
|
const last = mergedEdits[mergedEdits.length - 1];
|
|
675
|
-
if (last.edit.editType === CellEditType.Output
|
|
676
|
-
&& last.edit.append
|
|
677
|
-
&& edit.edit.editType === CellEditType.Output
|
|
678
|
-
&& edit.edit.append
|
|
679
|
-
&& last.cellIndex === edit.cellIndex) {
|
|
807
|
+
if (last.edit.editType === CellEditType.Output && last.edit.append && edit.edit.editType === CellEditType.Output && edit.edit.append && last.cellIndex === edit.cellIndex) {
|
|
680
808
|
last.edit.outputs = [...last.edit.outputs, ...edit.edit.outputs];
|
|
681
|
-
}
|
|
682
|
-
|
|
683
|
-
&& !last.edit.append
|
|
684
|
-
&& last.edit.outputs.length === 0
|
|
685
|
-
&& edit.edit.editType === CellEditType.Output
|
|
686
|
-
&& edit.edit.append
|
|
687
|
-
&& last.cellIndex === edit.cellIndex) {
|
|
809
|
+
} else if (
|
|
810
|
+
last.edit.editType === CellEditType.Output && !last.edit.append && last.edit.outputs.length === 0 && edit.edit.editType === CellEditType.Output && edit.edit.append && last.cellIndex === edit.cellIndex) {
|
|
688
811
|
last.edit.append = false;
|
|
689
812
|
last.edit.outputs = edit.edit.outputs;
|
|
690
|
-
}
|
|
691
|
-
else {
|
|
813
|
+
} else {
|
|
692
814
|
mergedEdits.push(edit);
|
|
693
815
|
}
|
|
694
|
-
}
|
|
695
|
-
else {
|
|
816
|
+
} else {
|
|
696
817
|
mergedEdits.push(edit);
|
|
697
818
|
}
|
|
698
819
|
});
|
|
699
820
|
return mergedEdits;
|
|
700
821
|
}
|
|
701
|
-
_replaceCells(
|
|
822
|
+
_replaceCells(
|
|
823
|
+
index,
|
|
824
|
+
count,
|
|
825
|
+
cellDtos,
|
|
826
|
+
synchronous,
|
|
827
|
+
computeUndoRedo,
|
|
828
|
+
beginSelectionState,
|
|
829
|
+
undoRedoGroup
|
|
830
|
+
) {
|
|
702
831
|
if (count === 0 && cellDtos.length === 0) {
|
|
703
832
|
return;
|
|
704
833
|
}
|
|
@@ -736,7 +865,7 @@ let NotebookTextModel = NotebookTextModel_1 = class NotebookTextModel extends Di
|
|
|
736
865
|
cell.textModel.setValue(cellDto.source);
|
|
737
866
|
cell.resetTextBuffer(cell.textModel.getTextBuffer());
|
|
738
867
|
}
|
|
739
|
-
const dirtyStateListener = cell.onDidChangeContent(
|
|
868
|
+
const dirtyStateListener = cell.onDidChangeContent(e => {
|
|
740
869
|
this._bindCellContentHandler(cell, e);
|
|
741
870
|
});
|
|
742
871
|
this.newCellsFromLastEdit.add(cell.handle);
|
|
@@ -751,7 +880,12 @@ let NotebookTextModel = NotebookTextModel_1 = class NotebookTextModel extends Di
|
|
|
751
880
|
}).map(diff => {
|
|
752
881
|
return [diff.start, diff.deleteCount, diff.toInsert];
|
|
753
882
|
}));
|
|
754
|
-
this._onWillAddRemoveCells.fire({
|
|
883
|
+
this._onWillAddRemoveCells.fire({
|
|
884
|
+
rawEvent: {
|
|
885
|
+
kind: NotebookCellsChangeType.ModelChange,
|
|
886
|
+
changes: diffs
|
|
887
|
+
}
|
|
888
|
+
});
|
|
755
889
|
this._cells = cellsCopy;
|
|
756
890
|
const undoDiff = ( diffs.map(diff => {
|
|
757
891
|
const deletedCells = oldViewCells.slice(diff[0], diff[0] + diff[1]);
|
|
@@ -759,13 +893,23 @@ let NotebookTextModel = NotebookTextModel_1 = class NotebookTextModel extends Di
|
|
|
759
893
|
}));
|
|
760
894
|
if (computeUndoRedo) {
|
|
761
895
|
this._operationManager.pushEditOperation(( new SpliceCellsEdit(this.uri, undoDiff, {
|
|
762
|
-
insertCell: (index, cell, endSelections) => {
|
|
763
|
-
|
|
764
|
-
|
|
896
|
+
insertCell: (index, cell, endSelections) => {
|
|
897
|
+
this._insertNewCell(index, [cell], true, endSelections);
|
|
898
|
+
},
|
|
899
|
+
deleteCell: (index, endSelections) => {
|
|
900
|
+
this._removeCell(index, 1, true, endSelections);
|
|
901
|
+
},
|
|
902
|
+
replaceCell: (index, count, cells, endSelections) => {
|
|
903
|
+
this._replaceNewCells(index, count, cells, true, endSelections);
|
|
904
|
+
}
|
|
765
905
|
}, undefined, undefined)), beginSelectionState, undefined, this._alternativeVersionId, undoRedoGroup);
|
|
766
906
|
}
|
|
767
907
|
this._pauseableEmitter.fire({
|
|
768
|
-
rawEvents: [{
|
|
908
|
+
rawEvents: [{
|
|
909
|
+
kind: NotebookCellsChangeType.ModelChange,
|
|
910
|
+
changes: diffs,
|
|
911
|
+
transient: false
|
|
912
|
+
}],
|
|
769
913
|
versionId: this.versionId,
|
|
770
914
|
synchronous: synchronous,
|
|
771
915
|
endSelectionState: undefined
|
|
@@ -780,7 +924,7 @@ let NotebookTextModel = NotebookTextModel_1 = class NotebookTextModel extends Di
|
|
|
780
924
|
}
|
|
781
925
|
_overwriteAlternativeVersionId(newAlternativeVersionId) {
|
|
782
926
|
this._alternativeVersionId = newAlternativeVersionId;
|
|
783
|
-
this._notebookSpecificAlternativeId = Number(newAlternativeVersionId.substring(0, newAlternativeVersionId.indexOf(
|
|
927
|
+
this._notebookSpecificAlternativeId = Number(newAlternativeVersionId.substring(0, newAlternativeVersionId.indexOf("_")));
|
|
784
928
|
}
|
|
785
929
|
_updateNotebookCellMetadata(metadata, computeUndoRedo, beginSelectionState, undoRedoGroup) {
|
|
786
930
|
const oldMetadata = this.metadata;
|
|
@@ -791,8 +935,8 @@ let NotebookTextModel = NotebookTextModel_1 = class NotebookTextModel extends Di
|
|
|
791
935
|
this._operationManager.pushEditOperation(new (class {
|
|
792
936
|
constructor() {
|
|
793
937
|
this.type = UndoRedoElementType.Resource;
|
|
794
|
-
this.label =
|
|
795
|
-
this.code =
|
|
938
|
+
this.label = "Update Cell Metadata";
|
|
939
|
+
this.code = "undoredo.textBufferEdit";
|
|
796
940
|
}
|
|
797
941
|
get resource() {
|
|
798
942
|
return that.uri;
|
|
@@ -808,7 +952,11 @@ let NotebookTextModel = NotebookTextModel_1 = class NotebookTextModel extends Di
|
|
|
808
952
|
}
|
|
809
953
|
this.metadata = metadata;
|
|
810
954
|
this._pauseableEmitter.fire({
|
|
811
|
-
rawEvents: [{
|
|
955
|
+
rawEvents: [{
|
|
956
|
+
kind: NotebookCellsChangeType.ChangeDocumentMetadata,
|
|
957
|
+
metadata: this.metadata,
|
|
958
|
+
transient: !triggerDirtyChange
|
|
959
|
+
}],
|
|
812
960
|
versionId: this.versionId,
|
|
813
961
|
synchronous: true,
|
|
814
962
|
endSelectionState: undefined
|
|
@@ -816,16 +964,25 @@ let NotebookTextModel = NotebookTextModel_1 = class NotebookTextModel extends Di
|
|
|
816
964
|
}
|
|
817
965
|
_insertNewCell(index, cells, synchronous, endSelections) {
|
|
818
966
|
for (let i = 0; i < cells.length; i++) {
|
|
819
|
-
const dirtyStateListener = cells[i].onDidChangeContent(
|
|
967
|
+
const dirtyStateListener = cells[i].onDidChangeContent(e => {
|
|
820
968
|
this._bindCellContentHandler(cells[i], e);
|
|
821
969
|
});
|
|
822
970
|
this._cellListeners.set(cells[i].handle, dirtyStateListener);
|
|
823
971
|
}
|
|
824
972
|
const changes = [[index, 0, cells]];
|
|
825
|
-
this._onWillAddRemoveCells.fire({
|
|
973
|
+
this._onWillAddRemoveCells.fire({
|
|
974
|
+
rawEvent: {
|
|
975
|
+
kind: NotebookCellsChangeType.ModelChange,
|
|
976
|
+
changes
|
|
977
|
+
}
|
|
978
|
+
});
|
|
826
979
|
this._cells.splice(index, 0, ...cells);
|
|
827
980
|
this._pauseableEmitter.fire({
|
|
828
|
-
rawEvents: [{
|
|
981
|
+
rawEvents: [{
|
|
982
|
+
kind: NotebookCellsChangeType.ModelChange,
|
|
983
|
+
changes,
|
|
984
|
+
transient: false
|
|
985
|
+
}],
|
|
829
986
|
versionId: this.versionId,
|
|
830
987
|
synchronous: synchronous,
|
|
831
988
|
endSelectionState: endSelections
|
|
@@ -839,10 +996,19 @@ let NotebookTextModel = NotebookTextModel_1 = class NotebookTextModel extends Di
|
|
|
839
996
|
this._cellListeners.delete(cell.handle);
|
|
840
997
|
}
|
|
841
998
|
const changes = [[index, count, []]];
|
|
842
|
-
this._onWillAddRemoveCells.fire({
|
|
999
|
+
this._onWillAddRemoveCells.fire({
|
|
1000
|
+
rawEvent: {
|
|
1001
|
+
kind: NotebookCellsChangeType.ModelChange,
|
|
1002
|
+
changes
|
|
1003
|
+
}
|
|
1004
|
+
});
|
|
843
1005
|
this._cells.splice(index, count);
|
|
844
1006
|
this._pauseableEmitter.fire({
|
|
845
|
-
rawEvents: [{
|
|
1007
|
+
rawEvents: [{
|
|
1008
|
+
kind: NotebookCellsChangeType.ModelChange,
|
|
1009
|
+
changes,
|
|
1010
|
+
transient: false
|
|
1011
|
+
}],
|
|
846
1012
|
versionId: this.versionId,
|
|
847
1013
|
synchronous: synchronous,
|
|
848
1014
|
endSelectionState: endSelections
|
|
@@ -855,16 +1021,25 @@ let NotebookTextModel = NotebookTextModel_1 = class NotebookTextModel extends Di
|
|
|
855
1021
|
this._cellListeners.delete(cell.handle);
|
|
856
1022
|
}
|
|
857
1023
|
for (let i = 0; i < cells.length; i++) {
|
|
858
|
-
const dirtyStateListener = cells[i].onDidChangeContent(
|
|
1024
|
+
const dirtyStateListener = cells[i].onDidChangeContent(e => {
|
|
859
1025
|
this._bindCellContentHandler(cells[i], e);
|
|
860
1026
|
});
|
|
861
1027
|
this._cellListeners.set(cells[i].handle, dirtyStateListener);
|
|
862
1028
|
}
|
|
863
1029
|
const changes = [[index, count, cells]];
|
|
864
|
-
this._onWillAddRemoveCells.fire({
|
|
1030
|
+
this._onWillAddRemoveCells.fire({
|
|
1031
|
+
rawEvent: {
|
|
1032
|
+
kind: NotebookCellsChangeType.ModelChange,
|
|
1033
|
+
changes
|
|
1034
|
+
}
|
|
1035
|
+
});
|
|
865
1036
|
this._cells.splice(index, count, ...cells);
|
|
866
1037
|
this._pauseableEmitter.fire({
|
|
867
|
-
rawEvents: [{
|
|
1038
|
+
rawEvents: [{
|
|
1039
|
+
kind: NotebookCellsChangeType.ModelChange,
|
|
1040
|
+
changes,
|
|
1041
|
+
transient: false
|
|
1042
|
+
}],
|
|
868
1043
|
versionId: this.versionId,
|
|
869
1044
|
synchronous: synchronous,
|
|
870
1045
|
endSelectionState: endSelections
|
|
@@ -873,16 +1048,11 @@ let NotebookTextModel = NotebookTextModel_1 = class NotebookTextModel extends Di
|
|
|
873
1048
|
_isDocumentMetadataChanged(a, b) {
|
|
874
1049
|
const keys = ( new Set([...( Object.keys(a || {})), ...( Object.keys(b || {}))]));
|
|
875
1050
|
for (const key of keys) {
|
|
876
|
-
if (key ===
|
|
877
|
-
if (!this._customMetadataEqual(a[key], b[key])
|
|
878
|
-
&&
|
|
879
|
-
!(this.transientOptions.transientDocumentMetadata[key])) {
|
|
1051
|
+
if (key === "custom") {
|
|
1052
|
+
if (!this._customMetadataEqual(a[key], b[key]) && !(this.transientOptions.transientDocumentMetadata[key])) {
|
|
880
1053
|
return true;
|
|
881
1054
|
}
|
|
882
|
-
}
|
|
883
|
-
else if ((a[key] !== b[key])
|
|
884
|
-
&&
|
|
885
|
-
!(this.transientOptions.transientDocumentMetadata[key])) {
|
|
1055
|
+
} else if ((a[key] !== b[key]) && !(this.transientOptions.transientDocumentMetadata[key])) {
|
|
886
1056
|
return true;
|
|
887
1057
|
}
|
|
888
1058
|
}
|
|
@@ -891,9 +1061,7 @@ let NotebookTextModel = NotebookTextModel_1 = class NotebookTextModel extends Di
|
|
|
891
1061
|
_isCellMetadataChanged(a, b) {
|
|
892
1062
|
const keys = ( new Set([...( Object.keys(a || {})), ...( Object.keys(b || {}))]));
|
|
893
1063
|
for (const key of keys) {
|
|
894
|
-
if ((a[key] !== b[key])
|
|
895
|
-
&&
|
|
896
|
-
!(this.transientOptions.transientCellMetadata[key])) {
|
|
1064
|
+
if ((a[key] !== b[key]) && !(this.transientOptions.transientCellMetadata[key])) {
|
|
897
1065
|
return true;
|
|
898
1066
|
}
|
|
899
1067
|
}
|
|
@@ -948,7 +1116,12 @@ let NotebookTextModel = NotebookTextModel_1 = class NotebookTextModel extends Di
|
|
|
948
1116
|
}
|
|
949
1117
|
cell.metadata = metadata;
|
|
950
1118
|
this._pauseableEmitter.fire({
|
|
951
|
-
rawEvents: [{
|
|
1119
|
+
rawEvents: [{
|
|
1120
|
+
kind: NotebookCellsChangeType.ChangeCellMetadata,
|
|
1121
|
+
index: this._cells.indexOf(cell),
|
|
1122
|
+
metadata: cell.metadata,
|
|
1123
|
+
transient: !triggerDirtyChange
|
|
1124
|
+
}],
|
|
952
1125
|
versionId: this.versionId,
|
|
953
1126
|
synchronous: true,
|
|
954
1127
|
endSelectionState: undefined
|
|
@@ -965,7 +1138,12 @@ let NotebookTextModel = NotebookTextModel_1 = class NotebookTextModel extends Di
|
|
|
965
1138
|
}
|
|
966
1139
|
cell.internalMetadata = newInternalMetadata;
|
|
967
1140
|
this._pauseableEmitter.fire({
|
|
968
|
-
rawEvents: [{
|
|
1141
|
+
rawEvents: [{
|
|
1142
|
+
kind: NotebookCellsChangeType.ChangeCellInternalMetadata,
|
|
1143
|
+
index: this._cells.indexOf(cell),
|
|
1144
|
+
internalMetadata: cell.internalMetadata,
|
|
1145
|
+
transient: true
|
|
1146
|
+
}],
|
|
969
1147
|
versionId: this.versionId,
|
|
970
1148
|
synchronous: true,
|
|
971
1149
|
endSelectionState: undefined
|
|
@@ -982,8 +1160,8 @@ let NotebookTextModel = NotebookTextModel_1 = class NotebookTextModel extends Di
|
|
|
982
1160
|
this._operationManager.pushEditOperation(new (class {
|
|
983
1161
|
constructor() {
|
|
984
1162
|
this.type = UndoRedoElementType.Resource;
|
|
985
|
-
this.label =
|
|
986
|
-
this.code =
|
|
1163
|
+
this.label = "Update Cell Language";
|
|
1164
|
+
this.code = "undoredo.textBufferEdit";
|
|
987
1165
|
}
|
|
988
1166
|
get resource() {
|
|
989
1167
|
return that.uri;
|
|
@@ -997,7 +1175,12 @@ let NotebookTextModel = NotebookTextModel_1 = class NotebookTextModel extends Di
|
|
|
997
1175
|
})(), beginSelectionState, undefined, this._alternativeVersionId, undoRedoGroup);
|
|
998
1176
|
}
|
|
999
1177
|
this._pauseableEmitter.fire({
|
|
1000
|
-
rawEvents: [{
|
|
1178
|
+
rawEvents: [{
|
|
1179
|
+
kind: NotebookCellsChangeType.ChangeCellLanguage,
|
|
1180
|
+
index: this._cells.indexOf(cell),
|
|
1181
|
+
language: languageId,
|
|
1182
|
+
transient: false
|
|
1183
|
+
}],
|
|
1001
1184
|
versionId: this.versionId,
|
|
1002
1185
|
synchronous: true,
|
|
1003
1186
|
endSelectionState: undefined
|
|
@@ -1008,7 +1191,11 @@ let NotebookTextModel = NotebookTextModel_1 = class NotebookTextModel extends Di
|
|
|
1008
1191
|
return;
|
|
1009
1192
|
}
|
|
1010
1193
|
if (outputs.length <= 1) {
|
|
1011
|
-
this._spliceNotebookCellOutputs(cell, {
|
|
1194
|
+
this._spliceNotebookCellOutputs(cell, {
|
|
1195
|
+
start: 0,
|
|
1196
|
+
deleteCount: cell.outputs.length,
|
|
1197
|
+
newOutputs: ( outputs.map(op => ( new NotebookCellOutputTextModel(op))))
|
|
1198
|
+
}, false, computeUndoRedo);
|
|
1012
1199
|
return;
|
|
1013
1200
|
}
|
|
1014
1201
|
const diff = ( new LcsDiff(( new OutputSequence(cell.outputs)), ( new OutputSequence(outputs))));
|
|
@@ -1026,12 +1213,12 @@ let NotebookTextModel = NotebookTextModel_1 = class NotebookTextModel extends Di
|
|
|
1026
1213
|
cell.spliceNotebookCellOutputs(splice);
|
|
1027
1214
|
this._pauseableEmitter.fire({
|
|
1028
1215
|
rawEvents: [{
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1216
|
+
kind: NotebookCellsChangeType.Output,
|
|
1217
|
+
index: this._cells.indexOf(cell),
|
|
1218
|
+
outputs: ( cell.outputs.map(output => output.asDto())) ?? [],
|
|
1219
|
+
append,
|
|
1220
|
+
transient: this.transientOptions.transientOutputs
|
|
1221
|
+
}],
|
|
1035
1222
|
versionId: this.versionId,
|
|
1036
1223
|
synchronous: true,
|
|
1037
1224
|
endSelectionState: undefined
|
|
@@ -1041,13 +1228,13 @@ let NotebookTextModel = NotebookTextModel_1 = class NotebookTextModel extends Di
|
|
|
1041
1228
|
if (cell.changeOutputItems(outputId, true, items)) {
|
|
1042
1229
|
this._pauseableEmitter.fire({
|
|
1043
1230
|
rawEvents: [{
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1231
|
+
kind: NotebookCellsChangeType.OutputItem,
|
|
1232
|
+
index: this._cells.indexOf(cell),
|
|
1233
|
+
outputId: outputId,
|
|
1234
|
+
outputItems: items,
|
|
1235
|
+
append: true,
|
|
1236
|
+
transient: this.transientOptions.transientOutputs
|
|
1237
|
+
}],
|
|
1051
1238
|
versionId: this.versionId,
|
|
1052
1239
|
synchronous: true,
|
|
1053
1240
|
endSelectionState: undefined
|
|
@@ -1058,25 +1245,43 @@ let NotebookTextModel = NotebookTextModel_1 = class NotebookTextModel extends Di
|
|
|
1058
1245
|
if (cell.changeOutputItems(outputId, false, items)) {
|
|
1059
1246
|
this._pauseableEmitter.fire({
|
|
1060
1247
|
rawEvents: [{
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1248
|
+
kind: NotebookCellsChangeType.OutputItem,
|
|
1249
|
+
index: this._cells.indexOf(cell),
|
|
1250
|
+
outputId: outputId,
|
|
1251
|
+
outputItems: items,
|
|
1252
|
+
append: false,
|
|
1253
|
+
transient: this.transientOptions.transientOutputs
|
|
1254
|
+
}],
|
|
1068
1255
|
versionId: this.versionId,
|
|
1069
1256
|
synchronous: true,
|
|
1070
1257
|
endSelectionState: undefined
|
|
1071
1258
|
});
|
|
1072
1259
|
}
|
|
1073
1260
|
}
|
|
1074
|
-
_moveCellToIdx(
|
|
1261
|
+
_moveCellToIdx(
|
|
1262
|
+
index,
|
|
1263
|
+
length,
|
|
1264
|
+
newIdx,
|
|
1265
|
+
synchronous,
|
|
1266
|
+
pushedToUndoStack,
|
|
1267
|
+
beforeSelections,
|
|
1268
|
+
endSelections,
|
|
1269
|
+
undoRedoGroup
|
|
1270
|
+
) {
|
|
1075
1271
|
if (pushedToUndoStack) {
|
|
1076
1272
|
this._operationManager.pushEditOperation(( new MoveCellEdit(this.uri, index, length, newIdx, {
|
|
1077
1273
|
moveCell: (fromIndex, length, toIndex, beforeSelections, endSelections) => {
|
|
1078
|
-
this._moveCellToIdx(
|
|
1079
|
-
|
|
1274
|
+
this._moveCellToIdx(
|
|
1275
|
+
fromIndex,
|
|
1276
|
+
length,
|
|
1277
|
+
toIndex,
|
|
1278
|
+
true,
|
|
1279
|
+
false,
|
|
1280
|
+
beforeSelections,
|
|
1281
|
+
endSelections,
|
|
1282
|
+
undoRedoGroup
|
|
1283
|
+
);
|
|
1284
|
+
}
|
|
1080
1285
|
}, beforeSelections, endSelections)), beforeSelections, endSelections, this._alternativeVersionId, undoRedoGroup);
|
|
1081
1286
|
}
|
|
1082
1287
|
this._assertIndex(index);
|
|
@@ -1084,7 +1289,14 @@ let NotebookTextModel = NotebookTextModel_1 = class NotebookTextModel extends Di
|
|
|
1084
1289
|
const cells = this._cells.splice(index, length);
|
|
1085
1290
|
this._cells.splice(newIdx, 0, ...cells);
|
|
1086
1291
|
this._pauseableEmitter.fire({
|
|
1087
|
-
rawEvents: [{
|
|
1292
|
+
rawEvents: [{
|
|
1293
|
+
kind: NotebookCellsChangeType.Move,
|
|
1294
|
+
index,
|
|
1295
|
+
length,
|
|
1296
|
+
newIdx,
|
|
1297
|
+
cells,
|
|
1298
|
+
transient: false
|
|
1299
|
+
}],
|
|
1088
1300
|
versionId: this.versionId,
|
|
1089
1301
|
synchronous: synchronous,
|
|
1090
1302
|
endSelectionState: endSelections
|
|
@@ -1115,14 +1327,16 @@ let NotebookTextModel = NotebookTextModel_1 = class NotebookTextModel extends Di
|
|
|
1115
1327
|
const searchRange = ( new Range(
|
|
1116
1328
|
searchStartPosition.lineNumber,
|
|
1117
1329
|
searchStartPosition.column,
|
|
1118
|
-
|
|
1119
|
-
|
|
1330
|
+
wrapFlag ? searchEnd.position.lineNumber : cell.textBuffer.getLineCount(),
|
|
1331
|
+
wrapFlag ? searchEnd.position.column : cell.textBuffer.getLineMaxColumn(cell.textBuffer.getLineCount())
|
|
1120
1332
|
));
|
|
1121
1333
|
const result = cell.textBuffer.findMatchesLineByLine(searchRange, searchData, false, 1);
|
|
1122
1334
|
if (result.length > 0) {
|
|
1123
|
-
return {
|
|
1124
|
-
|
|
1125
|
-
|
|
1335
|
+
return {
|
|
1336
|
+
cell,
|
|
1337
|
+
match: result[0]
|
|
1338
|
+
};
|
|
1339
|
+
} else if (wrapFlag) {
|
|
1126
1340
|
break;
|
|
1127
1341
|
}
|
|
1128
1342
|
cellIndex++;
|
|
@@ -1150,20 +1364,16 @@ let NotebookTextModel = NotebookTextModel_1 = class NotebookTextModel extends Di
|
|
|
1150
1364
|
));
|
|
1151
1365
|
const matches = cell.textBuffer.findMatchesLineByLine(searchRange, searchData, false, 1000);
|
|
1152
1366
|
if (matches.length > 0) {
|
|
1153
|
-
results.push({
|
|
1367
|
+
results.push({
|
|
1368
|
+
cell,
|
|
1369
|
+
matches: matches
|
|
1370
|
+
});
|
|
1154
1371
|
}
|
|
1155
1372
|
}
|
|
1156
1373
|
return results;
|
|
1157
1374
|
}
|
|
1158
1375
|
};
|
|
1159
|
-
NotebookTextModel = NotebookTextModel_1 = ( __decorate([
|
|
1160
|
-
( __param(5, IUndoRedoService)),
|
|
1161
|
-
( __param(6, IModelService)),
|
|
1162
|
-
( __param(7, ILanguageService)),
|
|
1163
|
-
( __param(8, ILanguageDetectionService)),
|
|
1164
|
-
( __param(9, INotebookExecutionStateService)),
|
|
1165
|
-
( __param(10, INotebookLoggingService))
|
|
1166
|
-
], NotebookTextModel));
|
|
1376
|
+
NotebookTextModel = NotebookTextModel_1 = ( __decorate([( __param(5, IUndoRedoService)), ( __param(6, IModelService)), ( __param(7, ILanguageService)), ( __param(8, ILanguageDetectionService)), ( __param(9, INotebookExecutionStateService)), ( __param(10, INotebookLoggingService))], NotebookTextModel));
|
|
1167
1377
|
class OutputSequence {
|
|
1168
1378
|
constructor(outputs) {
|
|
1169
1379
|
this.outputs = outputs;
|