Skip to content

Commit b4940e6

Browse files
committed
hygiene
1 parent f39299b commit b4940e6

File tree

2 files changed

+15
-11
lines changed

2 files changed

+15
-11
lines changed

src/vs/workbench/services/workingCopy/electron-sandbox/workingCopyBackupTracker.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -194,10 +194,14 @@ export class NativeWorkingCopyBackupTracker extends WorkingCopyBackupTracker imp
194194
return modifiedWorkingCopies; // backup because after window reload, backups restore
195195

196196
case ShutdownReason.LOAD:
197-
if (this.contextService.getWorkbenchState() !== WorkbenchState.EMPTY && this.filesConfigurationService.hotExitConfiguration === HotExitConfiguration.ON_EXIT_AND_WINDOW_CLOSE) {
198-
return modifiedWorkingCopies; // backup if a folder is open and onExitAndWindowClose is configured
197+
if (this.contextService.getWorkbenchState() !== WorkbenchState.EMPTY) {
198+
if (this.filesConfigurationService.hotExitConfiguration === HotExitConfiguration.ON_EXIT_AND_WINDOW_CLOSE) {
199+
return modifiedWorkingCopies; // backup if a folder is open and onExitAndWindowClose is configured
200+
} else {
201+
return modifiedWorkingCopies.filter(wc => wc.capabilities & WorkingCopyCapabilities.Scratchpad); // only backup scratchpads because we are switching contexts
202+
}
199203
} else {
200-
return modifiedWorkingCopies.filter(wc => wc.capabilities & WorkingCopyCapabilities.Scratchpad); // only backup scratchpads because we are switching contexts
204+
return []; // do not backup because we are switching contexts from an empty workspace
201205
}
202206
}
203207
}

src/vs/workbench/services/workingCopy/test/electron-sandbox/workingCopyBackupTracker.test.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -605,14 +605,14 @@ suite('WorkingCopyBackupTracker (native)', function () {
605605
test('should hot exit (reason: LOAD, windows: single, workspace)', function () {
606606
return scratchpadHotExitTest.call(this, HotExitConfiguration.ON_EXIT, ShutdownReason.LOAD, false, true, false);
607607
});
608-
test('should hot exit (reason: LOAD, windows: single, empty workspace)', function () {
609-
return scratchpadHotExitTest.call(this, HotExitConfiguration.ON_EXIT, ShutdownReason.LOAD, false, false, false);
608+
test('should NOT hot exit (reason: LOAD, windows: single, empty workspace)', function () {
609+
return scratchpadHotExitTest.call(this, HotExitConfiguration.ON_EXIT, ShutdownReason.LOAD, false, false, true);
610610
});
611611
test('should hot exit (reason: LOAD, windows: multiple, workspace)', function () {
612612
return scratchpadHotExitTest.call(this, HotExitConfiguration.ON_EXIT, ShutdownReason.LOAD, true, true, false);
613613
});
614-
test('should hot exit (reason: LOAD, windows: multiple, empty workspace)', function () {
615-
return scratchpadHotExitTest.call(this, HotExitConfiguration.ON_EXIT, ShutdownReason.LOAD, true, false, false);
614+
test('should NOT hot exit (reason: LOAD, windows: multiple, empty workspace)', function () {
615+
return scratchpadHotExitTest.call(this, HotExitConfiguration.ON_EXIT, ShutdownReason.LOAD, true, false, true);
616616
});
617617
});
618618

@@ -656,14 +656,14 @@ suite('WorkingCopyBackupTracker (native)', function () {
656656
test('should hot exit (reason: LOAD, windows: single, workspace)', function () {
657657
return scratchpadHotExitTest.call(this, HotExitConfiguration.ON_EXIT_AND_WINDOW_CLOSE, ShutdownReason.LOAD, false, true, false);
658658
});
659-
test('should hot exit (reason: LOAD, windows: single, empty workspace)', function () {
660-
return scratchpadHotExitTest.call(this, HotExitConfiguration.ON_EXIT_AND_WINDOW_CLOSE, ShutdownReason.LOAD, false, false, false);
659+
test('should NOT hot exit (reason: LOAD, windows: single, empty workspace)', function () {
660+
return scratchpadHotExitTest.call(this, HotExitConfiguration.ON_EXIT_AND_WINDOW_CLOSE, ShutdownReason.LOAD, false, false, true);
661661
});
662662
test('should hot exit (reason: LOAD, windows: multiple, workspace)', function () {
663663
return scratchpadHotExitTest.call(this, HotExitConfiguration.ON_EXIT_AND_WINDOW_CLOSE, ShutdownReason.LOAD, true, true, false);
664664
});
665-
test('should hot exit (reason: LOAD, windows: multiple, empty workspace)', function () {
666-
return scratchpadHotExitTest.call(this, HotExitConfiguration.ON_EXIT_AND_WINDOW_CLOSE, ShutdownReason.LOAD, true, false, false);
665+
test('should NOT hot exit (reason: LOAD, windows: multiple, empty workspace)', function () {
666+
return scratchpadHotExitTest.call(this, HotExitConfiguration.ON_EXIT_AND_WINDOW_CLOSE, ShutdownReason.LOAD, true, false, true);
667667
});
668668
});
669669

0 commit comments

Comments
 (0)