Skip to content

Commit 3019960

Browse files
authored
Merge pull request microsoft#163519 from debonte/notebookMultiMove
Fix `workspace.onDidChangeNotebookDocument` event for multi-cell moves
2 parents d634838 + 56d45b2 commit 3019960

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/vs/workbench/api/common/extHostNotebookDocument.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ export class ExtHostNotebookDocument {
247247
this._spliceNotebookCells(rawEvent.changes, false, result.contentChanges);
248248

249249
} else if (rawEvent.kind === notebookCommon.NotebookCellsChangeType.Move) {
250-
this._moveCell(rawEvent.index, rawEvent.newIdx, result.contentChanges);
250+
this._moveCells(rawEvent.index, rawEvent.length, rawEvent.newIdx, result.contentChanges);
251251

252252
} else if (rawEvent.kind === notebookCommon.NotebookCellsChangeType.Output) {
253253
this._setCellOutputs(rawEvent.index, rawEvent.outputs);
@@ -387,11 +387,11 @@ export class ExtHostNotebookDocument {
387387
}
388388
}
389389

390-
private _moveCell(index: number, newIdx: number, bucket: vscode.NotebookDocumentContentChange[]): void {
391-
const cells = this._cells.splice(index, 1);
390+
private _moveCells(index: number, length: number, newIdx: number, bucket: vscode.NotebookDocumentContentChange[]): void {
391+
const cells = this._cells.splice(index, length);
392392
this._cells.splice(newIdx, 0, ...cells);
393393
const changes = [
394-
new RawContentChangeEvent(index, 1, cells.map(c => c.apiCell), []),
394+
new RawContentChangeEvent(index, length, cells.map(c => c.apiCell), []),
395395
new RawContentChangeEvent(newIdx, 0, [], cells)
396396
];
397397
for (const change of changes) {

0 commit comments

Comments
 (0)