Skip to content

Commit 960e1bd

Browse files
committed
delay editor restore.
1 parent 6b57334 commit 960e1bd

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/vs/workbench/contrib/notebook/browser/viewModel/baseCellViewModel.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,8 @@ export abstract class BaseCellViewModel extends Disposable {
156156
this._onDidChangeState.fire({ outputCollapsedChanged: true });
157157
}
158158

159+
private _textEditorRestore: any;
160+
159161
constructor(
160162
readonly viewType: string,
161163
readonly model: NotebookCellTextModel,
@@ -234,7 +236,9 @@ export abstract class BaseCellViewModel extends Disposable {
234236
this._textEditor = editor;
235237

236238
if (this._editorViewStates) {
237-
this._restoreViewState(this._editorViewStates);
239+
this._textEditorRestore = setTimeout(() => {
240+
this._restoreViewState(this._editorViewStates);
241+
});
238242
}
239243

240244
if (this._editorTransientState) {
@@ -260,6 +264,7 @@ export abstract class BaseCellViewModel extends Disposable {
260264
}
261265

262266
detachTextEditor() {
267+
clearTimeout(this._textEditorRestore);
263268
this.saveViewState();
264269
this.saveTransientState();
265270
// decorations need to be cleared first as editors can be resued.
@@ -584,6 +589,7 @@ export abstract class BaseCellViewModel extends Disposable {
584589
super.dispose();
585590

586591
dispose(this._editorListeners);
592+
clearTimeout(this._textEditorRestore);
587593

588594
// Only remove the undo redo stack if we map this cell uri to itself
589595
// If we are not in perCell mode, it will map to the full NotebookDocument and

0 commit comments

Comments
 (0)