This commit is contained in:
aamunger 2023-05-26 11:08:35 -07:00
parent f39299b594
commit b4940e6446
No known key found for this signature in database
GPG key ID: F2CA0C6303FC6B74
2 changed files with 15 additions and 11 deletions

View file

@ -194,10 +194,14 @@ export class NativeWorkingCopyBackupTracker extends WorkingCopyBackupTracker imp
return modifiedWorkingCopies; // backup because after window reload, backups restore
case ShutdownReason.LOAD:
if (this.contextService.getWorkbenchState() !== WorkbenchState.EMPTY && this.filesConfigurationService.hotExitConfiguration === HotExitConfiguration.ON_EXIT_AND_WINDOW_CLOSE) {
return modifiedWorkingCopies; // backup if a folder is open and onExitAndWindowClose is configured
if (this.contextService.getWorkbenchState() !== WorkbenchState.EMPTY) {
if (this.filesConfigurationService.hotExitConfiguration === HotExitConfiguration.ON_EXIT_AND_WINDOW_CLOSE) {
return modifiedWorkingCopies; // backup if a folder is open and onExitAndWindowClose is configured
} else {
return modifiedWorkingCopies.filter(wc => wc.capabilities & WorkingCopyCapabilities.Scratchpad); // only backup scratchpads because we are switching contexts
}
} else {
return modifiedWorkingCopies.filter(wc => wc.capabilities & WorkingCopyCapabilities.Scratchpad); // only backup scratchpads because we are switching contexts
return []; // do not backup because we are switching contexts from an empty workspace
}
}
}

View file

@ -605,14 +605,14 @@ suite('WorkingCopyBackupTracker (native)', function () {
test('should hot exit (reason: LOAD, windows: single, workspace)', function () {
return scratchpadHotExitTest.call(this, HotExitConfiguration.ON_EXIT, ShutdownReason.LOAD, false, true, false);
});
test('should hot exit (reason: LOAD, windows: single, empty workspace)', function () {
return scratchpadHotExitTest.call(this, HotExitConfiguration.ON_EXIT, ShutdownReason.LOAD, false, false, false);
test('should NOT hot exit (reason: LOAD, windows: single, empty workspace)', function () {
return scratchpadHotExitTest.call(this, HotExitConfiguration.ON_EXIT, ShutdownReason.LOAD, false, false, true);
});
test('should hot exit (reason: LOAD, windows: multiple, workspace)', function () {
return scratchpadHotExitTest.call(this, HotExitConfiguration.ON_EXIT, ShutdownReason.LOAD, true, true, false);
});
test('should hot exit (reason: LOAD, windows: multiple, empty workspace)', function () {
return scratchpadHotExitTest.call(this, HotExitConfiguration.ON_EXIT, ShutdownReason.LOAD, true, false, false);
test('should NOT hot exit (reason: LOAD, windows: multiple, empty workspace)', function () {
return scratchpadHotExitTest.call(this, HotExitConfiguration.ON_EXIT, ShutdownReason.LOAD, true, false, true);
});
});
@ -656,14 +656,14 @@ suite('WorkingCopyBackupTracker (native)', function () {
test('should hot exit (reason: LOAD, windows: single, workspace)', function () {
return scratchpadHotExitTest.call(this, HotExitConfiguration.ON_EXIT_AND_WINDOW_CLOSE, ShutdownReason.LOAD, false, true, false);
});
test('should hot exit (reason: LOAD, windows: single, empty workspace)', function () {
return scratchpadHotExitTest.call(this, HotExitConfiguration.ON_EXIT_AND_WINDOW_CLOSE, ShutdownReason.LOAD, false, false, false);
test('should NOT hot exit (reason: LOAD, windows: single, empty workspace)', function () {
return scratchpadHotExitTest.call(this, HotExitConfiguration.ON_EXIT_AND_WINDOW_CLOSE, ShutdownReason.LOAD, false, false, true);
});
test('should hot exit (reason: LOAD, windows: multiple, workspace)', function () {
return scratchpadHotExitTest.call(this, HotExitConfiguration.ON_EXIT_AND_WINDOW_CLOSE, ShutdownReason.LOAD, true, true, false);
});
test('should hot exit (reason: LOAD, windows: multiple, empty workspace)', function () {
return scratchpadHotExitTest.call(this, HotExitConfiguration.ON_EXIT_AND_WINDOW_CLOSE, ShutdownReason.LOAD, true, false, false);
test('should NOT hot exit (reason: LOAD, windows: multiple, empty workspace)', function () {
return scratchpadHotExitTest.call(this, HotExitConfiguration.ON_EXIT_AND_WINDOW_CLOSE, ShutdownReason.LOAD, true, false, true);
});
});