@@ -156,6 +156,8 @@ export abstract class BaseCellViewModel extends Disposable {
156
156
this . _onDidChangeState . fire ( { outputCollapsedChanged : true } ) ;
157
157
}
158
158
159
+ private _textEditorRestore : any ;
160
+
159
161
constructor (
160
162
readonly viewType : string ,
161
163
readonly model : NotebookCellTextModel ,
@@ -234,7 +236,9 @@ export abstract class BaseCellViewModel extends Disposable {
234
236
this . _textEditor = editor ;
235
237
236
238
if ( this . _editorViewStates ) {
237
- this . _restoreViewState ( this . _editorViewStates ) ;
239
+ this . _textEditorRestore = setTimeout ( ( ) => {
240
+ this . _restoreViewState ( this . _editorViewStates ) ;
241
+ } ) ;
238
242
}
239
243
240
244
if ( this . _editorTransientState ) {
@@ -260,6 +264,7 @@ export abstract class BaseCellViewModel extends Disposable {
260
264
}
261
265
262
266
detachTextEditor ( ) {
267
+ clearTimeout ( this . _textEditorRestore ) ;
263
268
this . saveViewState ( ) ;
264
269
this . saveTransientState ( ) ;
265
270
// decorations need to be cleared first as editors can be resued.
@@ -584,6 +589,7 @@ export abstract class BaseCellViewModel extends Disposable {
584
589
super . dispose ( ) ;
585
590
586
591
dispose ( this . _editorListeners ) ;
592
+ clearTimeout ( this . _textEditorRestore ) ;
587
593
588
594
// Only remove the undo redo stack if we map this cell uri to itself
589
595
// If we are not in perCell mode, it will map to the full NotebookDocument and
0 commit comments