clear cell output in the core

This commit is contained in:
rebornix
2020-04-23 17:02:57 -07:00
parent e0a4eec778
commit 6c9398c3ea
5 changed files with 129 additions and 3 deletions

View File

@@ -251,6 +251,10 @@ export class ExtHostNotebookDocument extends Disposable implements vscode.Notebo
this.$spliceNotebookCells(event.changes);
} else if (event.kind === NotebookCellsChangeType.Move) {
this.$moveCell(event.index, event.newIdx);
} else if (event.kind === NotebookCellsChangeType.CellClearOutput) {
this.$clearCellOutputs(event.index);
} else if (event.kind === NotebookCellsChangeType.CellsClearOutput) {
this.$clearAllCellOutputs();
}
this._versionId = event.versionId;
@@ -299,6 +303,15 @@ export class ExtHostNotebookDocument extends Disposable implements vscode.Notebo
this.cells.splice(newIdx, 0, ...cells);
}
private $clearCellOutputs(index: number) {
const cell = this.cells[index];
cell.outputs = [];
}
private $clearAllCellOutputs() {
this.cells.forEach(cell => cell.outputs = []);
}
eventuallyUpdateCellOutputs(cell: ExtHostCell, diffs: ISplice<vscode.CellOutput>[]) {
let renderers = new Set<number>();
let outputDtos: NotebookCellOutputsSplice[] = diffs.map(diff => {