提交 241d4048 编写于 作者: B Benjamin Pasero

Losing content of unsaved files in workspace (fix #87156)

上级 f908b410
......@@ -37,7 +37,7 @@ export class BackupModelTracker extends Disposable implements IWorkbenchContribu
this._register(this.textFileService.models.onModelDisposed(e => this.discardBackup(e)));
// Listen for untitled model changes
this._register(this.untitledTextEditorService.onDidCreate(e => this.onUntitledModelChanged(e)));
this._register(this.untitledTextEditorService.onDidCreate(e => this.onUntitledModelCreated(e)));
this._register(this.untitledTextEditorService.onDidChangeContent(e => this.onUntitledModelChanged(e)));
this._register(this.untitledTextEditorService.onDidDisposeModel(e => this.discardBackup(e)));
......@@ -65,6 +65,12 @@ export class BackupModelTracker extends Disposable implements IWorkbenchContribu
}
}
private onUntitledModelCreated(resource: Uri): void {
if (this.untitledTextEditorService.isDirty(resource)) {
this.untitledTextEditorService.loadOrCreate({ resource }).then(model => model.backup());
}
}
private onUntitledModelChanged(resource: Uri): void {
if (this.untitledTextEditorService.isDirty(resource)) {
this.untitledTextEditorService.loadOrCreate({ resource }).then(model => model.backup());
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册