session of --extensionTestsPath should not be remembered (fixes #17489)

This commit is contained in:
Benjamin Pasero
2016-12-19 12:10:01 +01:00
parent bd55cb5312
commit a18f2b1d41
2 changed files with 17 additions and 7 deletions
+9 -2
View File
@@ -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;
+8 -5
View File
@@ -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 <IWindowState>{
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();
}