Skip to content

Commit 25c5563

Browse files
authored
Merge pull request microsoft#20938 from Microsoft/ben/16820
Hot Exit: Opens the same file twice in two separate windows
2 parents 89877dd + 646133c commit 25c5563

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

src/vs/code/electron-main/windows.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -373,8 +373,8 @@ export class WindowsManager implements IWindowsMainService {
373373
openFolderInNewWindow = (windowConfig.openFoldersInNewWindow === 'on');
374374
}
375375

376-
// Handle files to open/diff or to create when we dont open a folder
377-
if (!foldersToOpen.length && (filesToOpen.length > 0 || filesToCreate.length > 0 || filesToDiff.length > 0)) {
376+
// Handle files to open/diff or to create when we dont open a folder and we do not restore any folder/untitled from hot-exit
377+
if (!foldersToOpen.length && !foldersToRestore.length && !emptyToRestore.length && (filesToOpen.length > 0 || filesToCreate.length > 0 || filesToDiff.length > 0)) {
378378

379379
// let the user settings override how files are open in a new window or same window unless we are forced (not for extension development though)
380380
let openFilesInNewWindow: boolean;
@@ -471,10 +471,15 @@ export class WindowsManager implements IWindowsMainService {
471471
// Handle empty
472472
if (emptyToRestore.length > 0) {
473473
emptyToRestore.forEach(emptyWorkspaceBackupFolder => {
474-
const configuration = this.toConfiguration(openConfig);
474+
const configuration = this.toConfiguration(openConfig, void 0, filesToOpen, filesToCreate, filesToDiff);
475475
const browserWindow = this.openInBrowserWindow(configuration, true /* new window */, null, emptyWorkspaceBackupFolder);
476476
usedWindows.push(browserWindow);
477477

478+
// Reset these because we handled them
479+
filesToOpen = [];
480+
filesToCreate = [];
481+
filesToDiff = [];
482+
478483
openFolderInNewWindow = true; // any other folders to open must open in new window then
479484
});
480485
}

0 commit comments

Comments
 (0)