Skip to content

Commit 0d1530c

Browse files
committed
💄
1 parent baba378 commit 0d1530c

File tree

7 files changed

+35
-35
lines changed

7 files changed

+35
-35
lines changed

src/vs/workbench/api/browser/mainThreadNotebookEditors.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ export class MainThreadNotebookEditors implements MainThreadNotebookEditorsShape
112112
return false;
113113
}
114114
//todo@jrieken use proper selection logic!
115-
return editor.textModel.applyEdits(cellEdits.map(NotebookDto.fromCellEditOperationDto), true, undefined, () => undefined, undefined);
115+
return editor.textModel.applyEdits(cellEdits.map(NotebookDto.fromCellEditOperationDto), true, undefined, () => undefined, undefined, true);
116116
}
117117

118118
async $tryShowNotebookDocument(resource: UriComponents, viewType: string, options: INotebookDocumentShowOptions): Promise<string> {

src/vs/workbench/contrib/bulkEdit/browser/bulkCellEdits.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export class BulkCellEdits {
5656

5757
// apply edits
5858
const edits = group.map(entry => entry.cellEdit);
59-
ref.object.notebook.applyEdits(edits, true, undefined, () => undefined, this._undoRedoGroup);
59+
ref.object.notebook.applyEdits(edits, true, undefined, () => undefined, this._undoRedoGroup, true);
6060
ref.dispose();
6161

6262
this._progress.report(undefined);

src/vs/workbench/contrib/notebook/browser/contrib/clipboard/notebookClipboard.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ export function runPasteCells(editor: INotebookEditor, activeCell: ICellViewMode
131131
kind: SelectionStateType.Index,
132132
focus: { start: newFocusIndex, end: newFocusIndex + 1 },
133133
selections: [{ start: newFocusIndex, end: newFocusIndex + pasteCells.items.length }]
134-
}), undefined);
134+
}), undefined, true);
135135
} else {
136136
if (editor.getLength() !== 0) {
137137
return false;
@@ -148,7 +148,7 @@ export function runPasteCells(editor: INotebookEditor, activeCell: ICellViewMode
148148
kind: SelectionStateType.Index,
149149
focus: { start: 0, end: 1 },
150150
selections: [{ start: 1, end: pasteCells.items.length + 1 }]
151-
}), undefined);
151+
}), undefined, true);
152152
}
153153

154154
return true;

src/vs/workbench/contrib/notebook/browser/controller/editActions.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ registerAction2(class ClearCellOutputsAction extends NotebookCellAction {
208208
return;
209209
}
210210

211-
editor.textModel.applyEdits([{ editType: CellEditType.Output, index, outputs: [] }], true, undefined, () => undefined, undefined);
211+
editor.textModel.applyEdits([{ editType: CellEditType.Output, index, outputs: [] }], true, undefined, () => undefined, undefined, true);
212212

213213
const runState = notebookExecutionStateService.getCellExecution(context.cell.uri)?.state;
214214
if (runState !== NotebookCellExecutionState.Executing) {
@@ -220,7 +220,7 @@ registerAction2(class ClearCellOutputsAction extends NotebookCellAction {
220220
executionOrder: null,
221221
lastRunSuccess: null
222222
}
223-
}], true, undefined, () => undefined, undefined);
223+
}], true, undefined, () => undefined, undefined, true);
224224
}
225225
}
226226
});
@@ -266,7 +266,7 @@ registerAction2(class ClearAllCellOutputsAction extends NotebookAction {
266266
editor.textModel.applyEdits(
267267
editor.textModel.cells.map((cell, index) => ({
268268
editType: CellEditType.Output, index, outputs: []
269-
})), true, undefined, () => undefined, undefined);
269+
})), true, undefined, () => undefined, undefined, true);
270270

271271
const clearExecutionMetadataEdits = editor.textModel.cells.map((cell, index) => {
272272
const runState = notebookExecutionStateService.getCellExecution(cell.uri)?.state;
@@ -285,7 +285,7 @@ registerAction2(class ClearAllCellOutputsAction extends NotebookAction {
285285
}
286286
}).filter(edit => !!edit) as ICellEditOperation[];
287287
if (clearExecutionMetadataEdits.length) {
288-
context.notebookEditor.textModel.applyEdits(clearExecutionMetadataEdits, true, undefined, () => undefined, undefined);
288+
context.notebookEditor.textModel.applyEdits(clearExecutionMetadataEdits, true, undefined, () => undefined, undefined, true);
289289
}
290290
}
291291
});
@@ -451,7 +451,7 @@ registerAction2(class ChangeCellLanguageAction extends NotebookCellAction<ICellR
451451
const index = context.notebookEditor.textModel.cells.indexOf(context.cell.model);
452452
context.notebookEditor.textModel.applyEdits(
453453
[{ editType: CellEditType.CellLanguage, index, language: languageId }],
454-
true, undefined, () => undefined, undefined
454+
true, undefined, () => undefined, undefined, true
455455
);
456456
}
457457
}

src/vs/workbench/contrib/notebook/browser/diff/diffComponents.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,7 @@ abstract class AbstractElementRenderer extends Disposable {
517517

518518
this.notebookEditor.textModel!.applyEdits([
519519
{ editType: CellEditType.Metadata, index, metadata: result }
520-
], true, undefined, () => undefined, undefined);
520+
], true, undefined, () => undefined, undefined, true);
521521
} catch {
522522
}
523523
}

src/vs/workbench/contrib/notebook/browser/view/cellParts/cellDnd.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -499,6 +499,6 @@ export function performCellDropEdits(editor: INotebookEditorDelegate, draggedCel
499499
true,
500500
{ kind: SelectionStateType.Index, focus: editor.getFocus(), selections: editor.getSelections() },
501501
() => ({ kind: SelectionStateType.Index, focus: finalFocus, selections: [finalSelection] }),
502-
undefined);
502+
undefined, true);
503503
editor.revealCellRangeInView(finalSelection);
504504
}

src/vs/workbench/contrib/notebook/test/browser/notebookTextModel.test.ts

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ suite('NotebookTextModel', () => {
4040
textModel.applyEdits([
4141
{ editType: CellEditType.Replace, index: 1, count: 0, cells: [new TestCell(textModel.viewType, 5, 'var e = 5;', 'javascript', CellKind.Code, [], languageService)] },
4242
{ editType: CellEditType.Replace, index: 3, count: 0, cells: [new TestCell(textModel.viewType, 6, 'var f = 6;', 'javascript', CellKind.Code, [], languageService)] },
43-
], true, undefined, () => undefined, undefined);
43+
], true, undefined, () => undefined, undefined, true);
4444

4545
assert.strictEqual(textModel.cells.length, 6);
4646

@@ -63,7 +63,7 @@ suite('NotebookTextModel', () => {
6363
textModel.applyEdits([
6464
{ editType: CellEditType.Replace, index: 1, count: 0, cells: [new TestCell(textModel.viewType, 5, 'var e = 5;', 'javascript', CellKind.Code, [], languageService)] },
6565
{ editType: CellEditType.Replace, index: 1, count: 0, cells: [new TestCell(textModel.viewType, 6, 'var f = 6;', 'javascript', CellKind.Code, [], languageService)] },
66-
], true, undefined, () => undefined, undefined);
66+
], true, undefined, () => undefined, undefined, true);
6767

6868
assert.strictEqual(textModel.cells.length, 6);
6969

@@ -86,7 +86,7 @@ suite('NotebookTextModel', () => {
8686
textModel.applyEdits([
8787
{ editType: CellEditType.Replace, index: 1, count: 1, cells: [] },
8888
{ editType: CellEditType.Replace, index: 3, count: 1, cells: [] },
89-
], true, undefined, () => undefined, undefined);
89+
], true, undefined, () => undefined, undefined, true);
9090

9191
assert.strictEqual(textModel.cells[0].getValue(), 'var a = 1;');
9292
assert.strictEqual(textModel.cells[1].getValue(), 'var c = 3;');
@@ -107,7 +107,7 @@ suite('NotebookTextModel', () => {
107107
textModel.applyEdits([
108108
{ editType: CellEditType.Replace, index: 1, count: 1, cells: [] },
109109
{ editType: CellEditType.Replace, index: 3, count: 0, cells: [new TestCell(textModel.viewType, 5, 'var e = 5;', 'javascript', CellKind.Code, [], languageService)] },
110-
], true, undefined, () => undefined, undefined);
110+
], true, undefined, () => undefined, undefined, true);
111111
assert.strictEqual(textModel.cells.length, 4);
112112

113113
assert.strictEqual(textModel.cells[0].getValue(), 'var a = 1;');
@@ -129,7 +129,7 @@ suite('NotebookTextModel', () => {
129129
textModel.applyEdits([
130130
{ editType: CellEditType.Replace, index: 1, count: 1, cells: [] },
131131
{ editType: CellEditType.Replace, index: 1, count: 0, cells: [new TestCell(textModel.viewType, 5, 'var e = 5;', 'javascript', CellKind.Code, [], languageService)] },
132-
], true, undefined, () => undefined, undefined);
132+
], true, undefined, () => undefined, undefined, true);
133133

134134
assert.strictEqual(textModel.cells.length, 4);
135135
assert.strictEqual(textModel.cells[0].getValue(), 'var a = 1;');
@@ -151,7 +151,7 @@ suite('NotebookTextModel', () => {
151151
const textModel = editor.textModel;
152152
textModel.applyEdits([
153153
{ editType: CellEditType.Replace, index: 1, count: 1, cells: [new TestCell(textModel.viewType, 5, 'var e = 5;', 'javascript', CellKind.Code, [], languageService)] },
154-
], true, undefined, () => undefined, undefined);
154+
], true, undefined, () => undefined, undefined, true);
155155

156156
assert.strictEqual(textModel.cells.length, 4);
157157
assert.strictEqual(textModel.cells[0].getValue(), 'var a = 1;');
@@ -175,7 +175,7 @@ suite('NotebookTextModel', () => {
175175
index: Number.MAX_VALUE,
176176
editType: CellEditType.Output,
177177
outputs: []
178-
}], true, undefined, () => undefined, undefined);
178+
}], true, undefined, () => undefined, undefined, true);
179179
});
180180

181181
// invalid index 2
@@ -184,7 +184,7 @@ suite('NotebookTextModel', () => {
184184
index: -1,
185185
editType: CellEditType.Output,
186186
outputs: []
187-
}], true, undefined, () => undefined, undefined);
187+
}], true, undefined, () => undefined, undefined, true);
188188
});
189189

190190
textModel.applyEdits([{
@@ -194,7 +194,7 @@ suite('NotebookTextModel', () => {
194194
outputId: 'someId',
195195
outputs: [{ mime: Mimes.markdown, data: valueBytesFromString('_Hello_') }]
196196
}]
197-
}], true, undefined, () => undefined, undefined);
197+
}], true, undefined, () => undefined, undefined, true);
198198

199199
assert.strictEqual(textModel.cells.length, 1);
200200
assert.strictEqual(textModel.cells[0].outputs.length, 1);
@@ -208,7 +208,7 @@ suite('NotebookTextModel', () => {
208208
outputId: 'someId2',
209209
outputs: [{ mime: Mimes.markdown, data: valueBytesFromString('_Hello2_') }]
210210
}]
211-
}], true, undefined, () => undefined, undefined);
211+
}], true, undefined, () => undefined, undefined, true);
212212

213213
assert.strictEqual(textModel.cells.length, 1);
214214
assert.strictEqual(textModel.cells[0].outputs.length, 2);
@@ -224,7 +224,7 @@ suite('NotebookTextModel', () => {
224224
outputId: 'someId3',
225225
outputs: [{ mime: Mimes.text, data: valueBytesFromString('Last, replaced output') }]
226226
}]
227-
}], true, undefined, () => undefined, undefined);
227+
}], true, undefined, () => undefined, undefined, true);
228228

229229
assert.strictEqual(textModel.cells.length, 1);
230230
assert.strictEqual(textModel.cells[0].outputs.length, 1);
@@ -262,7 +262,7 @@ suite('NotebookTextModel', () => {
262262
outputs: [{ mime: Mimes.markdown, data: valueBytesFromString('append 2') }]
263263
}]
264264
}
265-
], true, undefined, () => undefined, undefined);
265+
], true, undefined, () => undefined, undefined, true);
266266

267267
assert.strictEqual(textModel.cells.length, 1);
268268
assert.strictEqual(textModel.cells[0].outputs.length, 2);
@@ -299,7 +299,7 @@ suite('NotebookTextModel', () => {
299299
mime: Mimes.markdown, data: valueBytesFromString('append 2')
300300
}]
301301
}
302-
], true, undefined, () => undefined, undefined);
302+
], true, undefined, () => undefined, undefined, true);
303303

304304
assert.strictEqual(textModel.cells.length, 1);
305305
assert.strictEqual(textModel.cells[0].outputs.length, 1, 'has 1 output');
@@ -324,7 +324,7 @@ suite('NotebookTextModel', () => {
324324
index: Number.MAX_VALUE,
325325
editType: CellEditType.Metadata,
326326
metadata: {}
327-
}], true, undefined, () => undefined, undefined);
327+
}], true, undefined, () => undefined, undefined, true);
328328
});
329329

330330
// invalid index 2
@@ -333,20 +333,20 @@ suite('NotebookTextModel', () => {
333333
index: -1,
334334
editType: CellEditType.Metadata,
335335
metadata: {}
336-
}], true, undefined, () => undefined, undefined);
336+
}], true, undefined, () => undefined, undefined, true);
337337
});
338338

339339
textModel.applyEdits([{
340340
index: 0,
341341
editType: CellEditType.Metadata,
342342
metadata: { customProperty: 15 },
343-
}], true, undefined, () => undefined, undefined);
343+
}], true, undefined, () => undefined, undefined, true);
344344

345345
textModel.applyEdits([{
346346
index: 0,
347347
editType: CellEditType.Metadata,
348348
metadata: {},
349-
}], true, undefined, () => undefined, undefined);
349+
}], true, undefined, () => undefined, undefined, true);
350350

351351
assert.strictEqual(textModel.cells.length, 1);
352352
assert.strictEqual(textModel.cells[0].metadata.customProperty, undefined);
@@ -366,13 +366,13 @@ suite('NotebookTextModel', () => {
366366
index: 0,
367367
editType: CellEditType.PartialMetadata,
368368
metadata: { customProperty: 15 },
369-
}], true, undefined, () => undefined, undefined);
369+
}], true, undefined, () => undefined, undefined, true);
370370

371371
textModel.applyEdits([{
372372
index: 0,
373373
editType: CellEditType.PartialMetadata,
374374
metadata: {},
375-
}], true, undefined, () => undefined, undefined);
375+
}], true, undefined, () => undefined, undefined, true);
376376

377377
assert.strictEqual(textModel.cells.length, 1);
378378
assert.strictEqual(textModel.cells[0].metadata.customProperty, 15);
@@ -403,7 +403,7 @@ suite('NotebookTextModel', () => {
403403
textModel.applyEdits([
404404
{ editType: CellEditType.Replace, index: 1, count: 1, cells: [] },
405405
{ editType: CellEditType.Replace, index: 1, count: 0, cells: [new TestCell(textModel.viewType, 5, 'var e = 5;', 'javascript', CellKind.Code, [], languageService)] },
406-
], true, undefined, () => ({ kind: SelectionStateType.Index, focus: { start: 0, end: 1 }, selections: [{ start: 0, end: 1 }] }), undefined);
406+
], true, undefined, () => ({ kind: SelectionStateType.Index, focus: { start: 0, end: 1 }, selections: [{ start: 0, end: 1 }] }), undefined, true);
407407

408408
assert.strictEqual(textModel.cells.length, 4);
409409
assert.strictEqual(textModel.cells[0].getValue(), 'var a = 1;');
@@ -449,7 +449,7 @@ suite('NotebookTextModel', () => {
449449
editType: CellEditType.Metadata,
450450
metadata: {},
451451
}
452-
], true, undefined, () => ({ kind: SelectionStateType.Index, focus: { start: 0, end: 1 }, selections: [{ start: 0, end: 1 }] }), undefined);
452+
], true, undefined, () => ({ kind: SelectionStateType.Index, focus: { start: 0, end: 1 }, selections: [{ start: 0, end: 1 }] }), undefined, true);
453453

454454
assert.notStrictEqual(changeEvent, undefined);
455455
assert.strictEqual(changeEvent!.rawEvents.length, 2);
@@ -641,7 +641,7 @@ suite('NotebookTextModel', () => {
641641
}
642642
];
643643

644-
editor.textModel.applyEdits(edits, true, undefined, () => undefined, undefined);
644+
editor.textModel.applyEdits(edits, true, undefined, () => undefined, undefined, true);
645645

646646
assert.strictEqual(notebook.cells[0].outputs.length, 1);
647647
assert.strictEqual(notebook.cells[0].outputs[0].outputs.length, 2);
@@ -671,7 +671,7 @@ suite('NotebookTextModel', () => {
671671
}
672672
];
673673

674-
editor.textModel.applyEdits(edits, true, undefined, () => undefined, undefined);
674+
editor.textModel.applyEdits(edits, true, undefined, () => undefined, undefined, true);
675675

676676
assert.strictEqual(notebook.cells.length, 2);
677677
assert.strictEqual(notebook.cells[0].outputs.length, 0);
@@ -707,7 +707,7 @@ suite('NotebookTextModel', () => {
707707
}
708708
];
709709

710-
editor.textModel.applyEdits(edits, true, undefined, () => undefined, undefined);
710+
editor.textModel.applyEdits(edits, true, undefined, () => undefined, undefined, true);
711711

712712
assert.strictEqual(notebook.cells.length, 2);
713713
assert.strictEqual(notebook.cells[0].outputs.length, 1);

0 commit comments

Comments
 (0)