From 7d6996b44bb6c5e1a59c9844c1b29161c915a6c6 Mon Sep 17 00:00:00 2001 From: rebornix Date: Thu, 16 Apr 2020 09:30:40 -0700 Subject: [PATCH] Cell View State restore --- .../workbench/contrib/notebook/browser/notebookEditor.ts | 4 ++-- .../workbench/contrib/notebook/test/testNotebookEditor.ts | 7 ++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/vs/workbench/contrib/notebook/browser/notebookEditor.ts b/src/vs/workbench/contrib/notebook/browser/notebookEditor.ts index 9824516bd92..845711847b4 100644 --- a/src/vs/workbench/contrib/notebook/browser/notebookEditor.ts +++ b/src/vs/workbench/contrib/notebook/browser/notebookEditor.ts @@ -428,8 +428,8 @@ export class NotebookEditor extends BaseEditor implements INotebookEditor { if (this.list) { state.scrollPosition = { left: this.list.scrollLeft, top: this.list.scrollTop }; let cellHeights: { [key: number]: number } = {}; - for (let i = 0; i < this.list.length; i++) { - const elm = this.list.element(i)!; + for (let i = 0; i < this.viewModel!.viewCells.length; i++) { + const elm = this.viewModel!.viewCells[i] as CellViewModel; if (elm.cellKind === CellKind.Code) { cellHeights[i] = elm.layoutInfo.totalHeight; } else { diff --git a/src/vs/workbench/contrib/notebook/test/testNotebookEditor.ts b/src/vs/workbench/contrib/notebook/test/testNotebookEditor.ts index 3494687cd5c..43ca6e0265a 100644 --- a/src/vs/workbench/contrib/notebook/test/testNotebookEditor.ts +++ b/src/vs/workbench/contrib/notebook/test/testNotebookEditor.ts @@ -9,7 +9,7 @@ import { CellKind, IOutput, CellUri, NotebookCellMetadata } from 'vs/workbench/c import { NotebookViewModel, IModelDecorationsChangeAccessor, CellViewModel } from 'vs/workbench/contrib/notebook/browser/viewModel/notebookViewModel'; import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import { NotebookEditorModel } from 'vs/workbench/contrib/notebook/browser/notebookEditorInput'; -import { INotebookEditor, NotebookLayoutInfo, ICellViewModel } from 'vs/workbench/contrib/notebook/browser/notebookBrowser'; +import { INotebookEditor, NotebookLayoutInfo, ICellViewModel, ICellRange } from 'vs/workbench/contrib/notebook/browser/notebookBrowser'; import { IMouseWheelEvent } from 'vs/base/browser/mouseEvent'; import { OutputRenderer } from 'vs/workbench/contrib/notebook/browser/view/output/outputRenderer'; import { BareFontInfo } from 'vs/editor/common/config/fontInfo'; @@ -49,6 +49,11 @@ export class TestNotebookEditor implements INotebookEditor { constructor( ) { } + + setHiddenAreas(_ranges: ICellRange[]): boolean { + throw new Error('Method not implemented.'); + } + getInnerWebview(): Webview | undefined { throw new Error('Method not implemented.'); } -- GitLab