diff --git a/src/vs/workbench/contrib/notebook/browser/notebookEditor.ts b/src/vs/workbench/contrib/notebook/browser/notebookEditor.ts index c0378bad9f4208f554747d992a7741b315a46816..5cc2f6a90ffc68c014d7b12901eaf7e5e3aa35b0 100644 --- a/src/vs/workbench/contrib/notebook/browser/notebookEditor.ts +++ b/src/vs/workbench/contrib/notebook/browser/notebookEditor.ts @@ -611,12 +611,20 @@ export class NotebookEditor extends BaseEditor implements INotebookEditor { async moveCellDown(cell: ICellViewModel): Promise { const index = this.notebookViewModel!.getViewCellIndex(cell); + if (index === this.notebookViewModel!.viewCells.length - 1) { + return; + } + const newIdx = index + 1; return this.moveCellToIndex(index, newIdx); } async moveCellUp(cell: ICellViewModel): Promise { const index = this.notebookViewModel!.getViewCellIndex(cell); + if (index === 0) { + return; + } + const newIdx = index - 1; return this.moveCellToIndex(index, newIdx); }