From f9d46f3ade09cea35145d88f2806dc6924ce8bdb Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Mon, 19 Jun 2017 09:52:30 +0200 Subject: [PATCH] migrate setting properly (for #207) --- src/vs/code/electron-main/windows.ts | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/vs/code/electron-main/windows.ts b/src/vs/code/electron-main/windows.ts index f291a2e6c7c..a3b8036a22e 100644 --- a/src/vs/code/electron-main/windows.ts +++ b/src/vs/code/electron-main/windows.ts @@ -602,9 +602,9 @@ export class WindowsManager implements IWindowsMainService { restoreWindows = 'all'; // always reopen all windows when an update was applied } else { const windowConfig = this.configurationService.getConfiguration('window'); - restoreWindows = (windowConfig && windowConfig.restoreWindows) as RestoreWindowsSetting; + restoreWindows = ((windowConfig && windowConfig.restoreWindows) || 'one') as RestoreWindowsSetting; - if (windowConfig && windowConfig.restoreWindows === 'one' /* default */ && windowConfig.reopenFolders) { + if (restoreWindows === 'one' /* default */ && windowConfig.reopenFolders) { restoreWindows = windowConfig.reopenFolders; // TODO@Ben migration } @@ -654,9 +654,12 @@ export class WindowsManager implements IWindowsMainService { // let the user settings override how folders are open in a new window or same window unless we are forced const windowConfig = this.configurationService.getConfiguration('window'); + const openFolderInNewWindowConfig = (windowConfig && windowConfig.openFoldersInNewWindow) || 'default' /* default */; + const openFilesInNewWindowConfig = (windowConfig && windowConfig.openFilesInNewWindow) || 'off' /* default */; + let openFolderInNewWindow = (openConfig.preferNewWindow || openConfig.forceNewWindow) && !openConfig.forceReuseWindow; - if (!openConfig.forceNewWindow && !openConfig.forceReuseWindow && windowConfig && (windowConfig.openFoldersInNewWindow === 'on' || windowConfig.openFoldersInNewWindow === 'off')) { - openFolderInNewWindow = (windowConfig.openFoldersInNewWindow === 'on'); + if (!openConfig.forceNewWindow && !openConfig.forceReuseWindow && (openFolderInNewWindowConfig === 'on' || openFolderInNewWindowConfig === 'off')) { + openFolderInNewWindow = (openFolderInNewWindowConfig === 'on'); } // 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) @@ -668,8 +671,8 @@ export class WindowsManager implements IWindowsMainService { openFilesInNewWindow = true; // only on macOS do we allow to open files in a new window if this is triggered via DOCK context } - if (!openConfig.cli.extensionDevelopmentPath && windowConfig && (windowConfig.openFilesInNewWindow === 'on' || windowConfig.openFilesInNewWindow === 'off')) { - openFilesInNewWindow = (windowConfig.openFilesInNewWindow === 'on'); + if (!openConfig.cli.extensionDevelopmentPath && (openFilesInNewWindowConfig === 'on' || openFilesInNewWindowConfig === 'off')) { + openFilesInNewWindow = (openFilesInNewWindowConfig === 'on'); } } -- GitLab