diff --git a/src/vs/editor/common/model/editStack.ts b/src/vs/editor/common/model/editStack.ts index bb67566ac5a..ad5a0f6d37d 100644 --- a/src/vs/editor/common/model/editStack.ts +++ b/src/vs/editor/common/model/editStack.ts @@ -161,11 +161,11 @@ export class SingleModelEditStackElement implements IResourceUndoRedoElement { return this.model.uri; } - public get label(): string { - return nls.localize('edit', "Typing"); - } - - constructor(model: ITextModel, beforeCursorState: Selection[] | null) { + constructor( + public readonly label: string, + model: ITextModel, + beforeCursorState: Selection[] | null + ) { this.model = model; this._data = SingleModelEditStackData.create(model, beforeCursorState); } @@ -413,7 +413,7 @@ export class EditStack { if (isEditStackElement(lastElement) && lastElement.canAppend(this._model)) { return lastElement; } - const newElement = new SingleModelEditStackElement(this._model, beforeCursorState); + const newElement = new SingleModelEditStackElement(nls.localize('edit', "Typing"), this._model, beforeCursorState); this._undoRedoService.pushElement(newElement); return newElement; } diff --git a/src/vs/workbench/contrib/bulkEdit/browser/bulkTextEdits.ts b/src/vs/workbench/contrib/bulkEdit/browser/bulkTextEdits.ts index 737c8d2a00d..c4042b8aec8 100644 --- a/src/vs/workbench/contrib/bulkEdit/browser/bulkTextEdits.ts +++ b/src/vs/workbench/contrib/bulkEdit/browser/bulkTextEdits.ts @@ -249,7 +249,7 @@ export class BulkTextEdits { // This edit touches a single model => keep things simple const task = tasks[0]; if (!task.isNoOp()) { - const singleModelEditStackElement = new SingleModelEditStackElement(task.model, task.getBeforeCursorState()); + const singleModelEditStackElement = new SingleModelEditStackElement(this._label, task.model, task.getBeforeCursorState()); this._undoRedoService.pushElement(singleModelEditStackElement, this._undoRedoGroup, this._undoRedoSource); task.apply(); singleModelEditStackElement.close(); @@ -259,7 +259,7 @@ export class BulkTextEdits { // prepare multi model undo element const multiModelEditStackElement = new MultiModelEditStackElement( this._label, - tasks.map(t => new SingleModelEditStackElement(t.model, t.getBeforeCursorState())) + tasks.map(t => new SingleModelEditStackElement(this._label, t.model, t.getBeforeCursorState())) ); this._undoRedoService.pushElement(multiModelEditStackElement, this._undoRedoGroup, this._undoRedoSource); for (const task of tasks) {