diff --git a/src/vs/platform/backup/test/node/backupMainService.test.ts b/src/vs/platform/backup/test/node/backupMainService.test.ts index 5618d3a115a..816fe31856e 100644 --- a/src/vs/platform/backup/test/node/backupMainService.test.ts +++ b/src/vs/platform/backup/test/node/backupMainService.test.ts @@ -101,9 +101,9 @@ suite('BackupMainService', () => { const untitledBackup2 = path.join(untitledBackupDir, 'foo'); pfs.mkdirp(untitledBackupDir).then(() => { pfs.writeFile(untitledBackup1, 'test').then(() => { - assert.deepEqual(service.getWorkspaceUntitledFileBackupsSync(fooFile), [untitledBackup1]); + assert.deepEqual(service.getWorkspaceUntitledFileBackupsSync(fooFile), ['bar']); pfs.writeFile(untitledBackup2, 'test').then(() => { - assert.deepEqual(service.getWorkspaceUntitledFileBackupsSync(fooFile), [untitledBackup1, untitledBackup2]); + assert.deepEqual(service.getWorkspaceUntitledFileBackupsSync(fooFile), ['bar', 'foo']); done(); }); }); diff --git a/src/vs/workbench/common/editor/untitledEditorInput.ts b/src/vs/workbench/common/editor/untitledEditorInput.ts index bd997ecbf79..21ebf3e3499 100644 --- a/src/vs/workbench/common/editor/untitledEditorInput.ts +++ b/src/vs/workbench/common/editor/untitledEditorInput.ts @@ -86,6 +86,11 @@ export class UntitledEditorInput extends AbstractUntitledEditorInput { return this.cachedModel.isDirty(); } + // A disposed input is never dirty, even if it was restored from backup + if (this.isDisposed()) { + return false; + } + // untitled files with an associated path or associated resource return this.hasAssociatedFilePath || !!this.resource; }