diff --git a/src/vs/code/electron-main/window.ts b/src/vs/code/electron-main/window.ts index a26de77fea4..56ac66e4c3c 100644 --- a/src/vs/code/electron-main/window.ts +++ b/src/vs/code/electron-main/window.ts @@ -30,6 +30,7 @@ export interface IWindowState { export interface IWindowCreationOptions { state: IWindowState; extensionDevelopmentPath?: string; + isExtensionTestHost?: boolean; allowFullscreen?: boolean; titleBarStyle?: 'native' | 'custom'; } @@ -139,6 +140,7 @@ export class VSCodeWindow implements IVSCodeWindow { private _lastFocusTime: number; private _readyState: ReadyState; private _extensionDevelopmentPath: string; + private _isExtensionTestHost: boolean; private windowState: IWindowState; private currentWindowMode: WindowMode; @@ -158,6 +160,7 @@ export class VSCodeWindow implements IVSCodeWindow { this._lastFocusTime = -1; this._readyState = ReadyState.NONE; this._extensionDevelopmentPath = config.extensionDevelopmentPath; + this._isExtensionTestHost = config.isExtensionTestHost; this.whenReadyCallbacks = []; // Load window state @@ -242,10 +245,14 @@ export class VSCodeWindow implements IVSCodeWindow { return this.hiddenTitleBarStyle; } - public get isPluginDevelopmentHost(): boolean { + public get isExtensionDevelopmentHost(): boolean { return !!this._extensionDevelopmentPath; } + public get isExtensionTestHost(): boolean { + return this._isExtensionTestHost; + } + public get extensionDevelopmentPath(): string { return this._extensionDevelopmentPath; } @@ -444,7 +451,7 @@ export class VSCodeWindow implements IVSCodeWindow { // Some configuration things get inherited if the window is being reloaded and we are // in plugin development mode. These options are all development related. - if (this.isPluginDevelopmentHost && cli) { + if (this.isExtensionDevelopmentHost && cli) { configuration.verbose = cli.verbose; configuration.debugPluginHost = cli.debugPluginHost; configuration.debugBrkPluginHost = cli.debugBrkPluginHost; diff --git a/src/vs/code/electron-main/windows.ts b/src/vs/code/electron-main/windows.ts index 7735e5d527f..464606f20a2 100644 --- a/src/vs/code/electron-main/windows.ts +++ b/src/vs/code/electron-main/windows.ts @@ -237,7 +237,7 @@ export class WindowsManager implements IWindowsMainService { } // 2-N windows open: Keep a list of windows that are opened on a specific folder to restore it in the next session as needed - this.windowsState.openedFolders = WindowsManager.WINDOWS.filter(w => w.readyState === ReadyState.READY && !!w.openedWorkspacePath && !w.isPluginDevelopmentHost).map(w => { + this.windowsState.openedFolders = WindowsManager.WINDOWS.filter(w => w.readyState === ReadyState.READY && !!w.openedWorkspacePath && !w.isExtensionDevelopmentHost).map(w => { return { workspacePath: w.openedWorkspacePath, uiState: w.serializeWindowState() @@ -456,7 +456,7 @@ export class WindowsManager implements IWindowsMainService { // Remember in recent document list (unless this opens for extension development) // Also do not add paths when files are opened for diffing, only if opened individually - if (!usedWindows.some(w => w.isPluginDevelopmentHost) && !openConfig.cli.diff) { + if (!usedWindows.some(w => w.isExtensionDevelopmentHost) && !openConfig.cli.diff) { const recentPaths: { path: string; isFile?: boolean; }[] = []; iPathsToOpen.forEach(iPath => { @@ -727,6 +727,7 @@ export class WindowsManager implements IWindowsMainService { vscodeWindow = new VSCodeWindow({ state: this.getNewWindowState(configuration), extensionDevelopmentPath: configuration.extensionDevelopmentPath, + isExtensionTestHost: !!configuration.extensionTestsPath, allowFullscreen: this.lifecycleService.wasUpdated || (windowConfig && windowConfig.restoreFullscreen), titleBarStyle: windowConfig ? windowConfig.titleBarStyle : void 0 }, @@ -1090,8 +1091,10 @@ export class WindowsManager implements IWindowsMainService { // On Window close, update our stored state of this window const state: IWindowState = { workspacePath: win.openedWorkspacePath, uiState: win.serializeWindowState() }; - if (win.isPluginDevelopmentHost) { - this.windowsState.lastPluginDevelopmentHostWindow = state; + if (win.isExtensionDevelopmentHost) { + if (!win.isExtensionTestHost) { + this.windowsState.lastPluginDevelopmentHostWindow = state; // do not let test run window state overwrite our extension development state + } } else { this.windowsState.lastActiveWindow = state; @@ -1225,7 +1228,7 @@ export class WindowsManager implements IWindowsMainService { // If the user selected to exit from an extension development host window, do not quit, but just // close the window unless this is the last window that is opened. const vscodeWindow = this.getFocusedWindow(); - if (vscodeWindow && vscodeWindow.isPluginDevelopmentHost && this.getWindowCount() > 1) { + if (vscodeWindow && vscodeWindow.isExtensionDevelopmentHost && this.getWindowCount() > 1) { vscodeWindow.win.close(); }