提交 4ac353bf 编写于 作者: D Daniel Imms

Cancel backup promises on save and dispose

Fixes #15748
上级 23217e2f
......@@ -108,9 +108,10 @@ export class TextFileEditorModel extends BaseTextEditorModel implements ITextFil
this.toDispose.push(this.textFileService.onFilesAssociationChange(e => this.onFilesAssociationChange()));
this.toDispose.push(this.onDidStateChange(e => {
if (e === StateChange.REVERTED) {
// Refire reverted events as content change events, cancelling any content change
// promises that are in flight.
// Cancel any content change event promises as they are no longer valid.
this.contentChangeEventScheduler.cancel();
// Refire state change reverted events as content change events
this._onDidContentChange.fire(StateChange.REVERTED);
}
}));
......@@ -544,6 +545,9 @@ export class TextFileEditorModel extends BaseTextEditorModel implements ITextFil
// Updated resolved stat with updated stat, and keep old for event
this.updateVersionOnDiskStat(stat);
// Cancel any content change event promises as they are no longer valid
this.contentChangeEventScheduler.cancel();
// Emit File Saved Event
this._onDidStateChange.fire(StateChange.SAVED);
}, (error) => {
......@@ -765,6 +769,7 @@ export class TextFileEditorModel extends BaseTextEditorModel implements ITextFil
this.createTextEditorModelPromise = null;
this.cancelAutoSavePromises();
this.contentChangeEventScheduler.cancel();
super.dispose();
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册