re #128173. remove edit stack on cell dispose.

This commit is contained in:
rebornix 2021-08-11 16:41:42 -07:00
parent 5cc49bd470
commit 1d9ac5e14a
3 changed files with 10 additions and 2 deletions

View file

@ -19,6 +19,7 @@ import { IConfigurationService } from 'vs/platform/configuration/common/configur
import { IResolvedTextEditorModel, ITextModelService } from 'vs/editor/common/services/resolverService';
import { ViewContext } from 'vs/workbench/contrib/notebook/browser/viewModel/viewContext';
import { Mimes } from 'vs/base/common/mime';
import { IUndoRedoService } from 'vs/platform/undoRedo/common/undoRedo';
export abstract class BaseCellViewModel extends Disposable {
@ -150,6 +151,7 @@ export abstract class BaseCellViewModel extends Disposable {
private readonly _viewContext: ViewContext,
private readonly _configurationService: IConfigurationService,
private readonly _modelService: ITextModelService,
private readonly _undoRedoService: IUndoRedoService
) {
super();
@ -538,6 +540,8 @@ export abstract class BaseCellViewModel extends Disposable {
override dispose() {
super.dispose();
this._undoRedoService.removeElements(this.uri);
if (this._textModelRef) {
this._textModelRef.dispose();
}

View file

@ -9,6 +9,7 @@ import * as editorCommon from 'vs/editor/common/editorCommon';
import { ITextModelService } from 'vs/editor/common/services/resolverService';
import { PrefixSumComputer } from 'vs/editor/common/viewModel/prefixSumComputer';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { IUndoRedoService } from 'vs/platform/undoRedo/common/undoRedo';
import { CellEditState, CellFindMatch, CodeCellLayoutChangeEvent, CodeCellLayoutInfo, CodeCellLayoutState, ICellOutputViewModel, ICellViewModel, NotebookLayoutInfo } from 'vs/workbench/contrib/notebook/browser/notebookBrowser';
import { CellOutputViewModel } from 'vs/workbench/contrib/notebook/browser/viewModel/cellOutputViewModel';
import { ViewContext } from 'vs/workbench/contrib/notebook/browser/viewModel/viewContext';
@ -103,8 +104,9 @@ export class CodeCellViewModel extends BaseCellViewModel implements ICellViewMod
@IConfigurationService configurationService: IConfigurationService,
@INotebookService private readonly _notebookService: INotebookService,
@ITextModelService modelService: ITextModelService,
@IUndoRedoService undoRedoService: IUndoRedoService
) {
super(viewType, model, UUID.generateUuid(), viewContext, configurationService, modelService);
super(viewType, model, UUID.generateUuid(), viewContext, configurationService, modelService, undoRedoService);
this._outputViewModels = this.model.outputs.map(output => new CellOutputViewModel(this, output, this._notebookService));
this._register(this.model.onDidChangeOutputs((splice) => {

View file

@ -16,6 +16,7 @@ import { CellKind, INotebookSearchOptions } from 'vs/workbench/contrib/notebook/
import { ITextModelService } from 'vs/editor/common/services/resolverService';
import { ViewContext } from 'vs/workbench/contrib/notebook/browser/viewModel/viewContext';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { IUndoRedoService } from 'vs/platform/undoRedo/common/undoRedo';
export class MarkupCellViewModel extends BaseCellViewModel implements ICellViewModel {
@ -114,8 +115,9 @@ export class MarkupCellViewModel extends BaseCellViewModel implements ICellViewM
@IConfigurationService configurationService: IConfigurationService,
@ITextModelService textModelService: ITextModelService,
@IInstantiationService instantiationService: IInstantiationService,
@IUndoRedoService undoRedoService: IUndoRedoService
) {
super(viewType, model, UUID.generateUuid(), viewContext, configurationService, textModelService);
super(viewType, model, UUID.generateUuid(), viewContext, configurationService, textModelService, undoRedoService);
const { bottomToolbarGap } = this.viewContext.notebookOptions.computeBottomToolbarDimensions(this.viewType);