Skip to content

Commit f39299b

Browse files
committed
backup and recover scratchpads for exitreason=load
1 parent 4cb8a48 commit f39299b

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ export class NativeWorkingCopyBackupTracker extends WorkingCopyBackupTracker imp
197197
if (this.contextService.getWorkbenchState() !== WorkbenchState.EMPTY && this.filesConfigurationService.hotExitConfiguration === HotExitConfiguration.ON_EXIT_AND_WINDOW_CLOSE) {
198198
return modifiedWorkingCopies; // backup if a folder is open and onExitAndWindowClose is configured
199199
} else {
200-
return []; // do not backup because we are switching contexts
200+
return modifiedWorkingCopies.filter(wc => wc.capabilities & WorkingCopyCapabilities.Scratchpad); // only backup scratchpads because we are switching contexts
201201
}
202202
}
203203
}

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

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -602,17 +602,17 @@ suite('WorkingCopyBackupTracker (native)', function () {
602602
test('should hot exit (reason: RELOAD, windows: multiple, empty workspace)', function () {
603603
return scratchpadHotExitTest.call(this, HotExitConfiguration.ON_EXIT, ShutdownReason.RELOAD, true, false, false);
604604
});
605-
test('should NOT hot exit (reason: LOAD, windows: single, workspace)', function () {
606-
return scratchpadHotExitTest.call(this, HotExitConfiguration.ON_EXIT, ShutdownReason.LOAD, false, true, true);
605+
test('should hot exit (reason: LOAD, windows: single, workspace)', function () {
606+
return scratchpadHotExitTest.call(this, HotExitConfiguration.ON_EXIT, ShutdownReason.LOAD, false, true, false);
607607
});
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);
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);
610610
});
611-
test('should NOT hot exit (reason: LOAD, windows: multiple, workspace)', function () {
612-
return scratchpadHotExitTest.call(this, HotExitConfiguration.ON_EXIT, ShutdownReason.LOAD, true, true, true);
611+
test('should hot exit (reason: LOAD, windows: multiple, workspace)', function () {
612+
return scratchpadHotExitTest.call(this, HotExitConfiguration.ON_EXIT, ShutdownReason.LOAD, true, true, false);
613613
});
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);
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);
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 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);
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);
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 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);
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);
667667
});
668668
});
669669

0 commit comments

Comments
 (0)