mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-15 10:58:31 -05:00
Merge vscode 1.67 (#20883)
* Fix initial build breaks from 1.67 merge (#2514) * Update yarn lock files * Update build scripts * Fix tsconfig * Build breaks * WIP * Update yarn lock files * Misc breaks * Updates to package.json * Breaks * Update yarn * Fix breaks * Breaks * Build breaks * Breaks * Breaks * Breaks * Breaks * Breaks * Missing file * Breaks * Breaks * Breaks * Breaks * Breaks * Fix several runtime breaks (#2515) * Missing files * Runtime breaks * Fix proxy ordering issue * Remove commented code * Fix breaks with opening query editor * Fix post merge break * Updates related to setup build and other breaks (#2516) * Fix bundle build issues * Update distro * Fix distro merge and update build JS files * Disable pipeline steps * Remove stats call * Update license name * Make new RPM dependencies a warning * Fix extension manager version checks * Update JS file * Fix a few runtime breaks * Fixes * Fix runtime issues * Fix build breaks * Update notebook tests (part 1) * Fix broken tests * Linting errors * Fix hygiene * Disable lint rules * Bump distro * Turn off smoke tests * Disable integration tests * Remove failing "activate" test * Remove failed test assertion * Disable other broken test * Disable query history tests * Disable extension unit tests * Disable failing tasks
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { app, BrowserWindow, BrowserWindowConstructorOptions, Display, Event, nativeImage, NativeImage, Rectangle, screen, SegmentedControlSegment, systemPreferences, TouchBar, TouchBarSegmentedControl, WebFrameMain } from 'electron';
|
||||
import { app, BrowserWindow, BrowserWindowConstructorOptions, Display, Event, nativeImage, NativeImage, Rectangle, screen, SegmentedControlSegment, systemPreferences, TouchBar, TouchBarSegmentedControl } from 'electron';
|
||||
import { RunOnceScheduler } from 'vs/base/common/async';
|
||||
import { CancellationToken } from 'vs/base/common/cancellation';
|
||||
import { toErrorMessage } from 'vs/base/common/errorMessage';
|
||||
@@ -16,27 +16,29 @@ import { getMarks, mark } from 'vs/base/common/performance';
|
||||
import { isLinux, isMacintosh, isWindows } from 'vs/base/common/platform';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { localize } from 'vs/nls';
|
||||
import { ISerializableCommandAction } from 'vs/platform/actions/common/actions';
|
||||
import { ISerializableCommandAction } from 'vs/platform/action/common/action';
|
||||
import { IBackupMainService } from 'vs/platform/backup/electron-main/backup';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { IDialogMainService } from 'vs/platform/dialogs/electron-main/dialogMainService';
|
||||
import { NativeParsedArgs } from 'vs/platform/environment/common/argv';
|
||||
import { IEnvironmentMainService } from 'vs/platform/environment/electron-main/environmentMainService';
|
||||
import { isLaunchedFromCli } from 'vs/platform/environment/node/argvHelper';
|
||||
import { resolveMarketplaceHeaders } from 'vs/platform/extensionManagement/common/extensionGalleryService';
|
||||
import { IFileService } from 'vs/platform/files/common/files';
|
||||
import { ILifecycleMainService } from 'vs/platform/lifecycle/electron-main/lifecycleMainService';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
import { IProductService } from 'vs/platform/product/common/productService';
|
||||
import { IProtocolMainService } from 'vs/platform/protocol/electron-main/protocol';
|
||||
import { IStorageMainService } from 'vs/platform/storage/electron-main/storageMainService';
|
||||
import { resolveMarketplaceHeaders } from 'vs/platform/externalServices/common/marketplace';
|
||||
import { IGlobalStorageMainService, IStorageMainService } from 'vs/platform/storage/electron-main/storageMainService';
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { ThemeIcon } from 'vs/platform/theme/common/themeService';
|
||||
import { IThemeMainService } from 'vs/platform/theme/electron-main/themeMainService';
|
||||
import { getMenuBarVisibility, getTitleBarStyle, IFolderToOpen, INativeWindowConfiguration, IWindowSettings, IWorkspaceToOpen, MenuBarVisibility, WindowMinimumSize, zoomLevelToZoomFactor } from 'vs/platform/windows/common/windows';
|
||||
import { defaultWindowState, ICodeWindow, ILoadEvent, IWindowsMainService, IWindowState, LoadReason, OpenContext, WindowError, WindowMode } from 'vs/platform/windows/electron-main/windows';
|
||||
import { ISingleFolderWorkspaceIdentifier, isSingleFolderWorkspaceIdentifier, isWorkspaceIdentifier, IWorkspaceIdentifier } from 'vs/platform/workspaces/common/workspaces';
|
||||
import { getMenuBarVisibility, getTitleBarStyle, IFolderToOpen, INativeWindowConfiguration, IWindowSettings, IWorkspaceToOpen, MenuBarVisibility, WindowMinimumSize, zoomLevelToZoomFactor } from 'vs/platform/window/common/window';
|
||||
import { IWindowsMainService, OpenContext } from 'vs/platform/windows/electron-main/windows';
|
||||
import { ISingleFolderWorkspaceIdentifier, IWorkspaceIdentifier, isSingleFolderWorkspaceIdentifier, isWorkspaceIdentifier } from 'vs/platform/workspace/common/workspace';
|
||||
import { IWorkspacesManagementMainService } from 'vs/platform/workspaces/electron-main/workspacesManagementMainService';
|
||||
import { IWindowState, ICodeWindow, ILoadEvent, WindowMode, WindowError, LoadReason, defaultWindowState } from 'vs/platform/window/electron-main/window';
|
||||
import { Color } from 'vs/base/common/color';
|
||||
|
||||
export interface IWindowCreationOptions {
|
||||
state: IWindowState;
|
||||
@@ -56,22 +58,21 @@ interface ILoadOptions {
|
||||
const enum ReadyState {
|
||||
|
||||
/**
|
||||
* This window has not loaded any HTML yet
|
||||
* This window has not loaded anything yet
|
||||
* and this is the initial state of every
|
||||
* window.
|
||||
*/
|
||||
NONE,
|
||||
|
||||
/**
|
||||
* This window is loading HTML
|
||||
*/
|
||||
LOADING,
|
||||
|
||||
/**
|
||||
* This window is navigating to another HTML
|
||||
* This window is navigating, either for the
|
||||
* first time or subsequent times.
|
||||
*/
|
||||
NAVIGATING,
|
||||
|
||||
/**
|
||||
* This window is done loading HTML
|
||||
* This window has finished loading and is ready
|
||||
* to forward IPC requests to the web contents.
|
||||
*/
|
||||
READY
|
||||
}
|
||||
@@ -106,23 +107,23 @@ export class CodeWindow extends Disposable implements ICodeWindow {
|
||||
private _lastFocusTime = -1;
|
||||
get lastFocusTime(): number { return this._lastFocusTime; }
|
||||
|
||||
get backupPath(): string | undefined { return this.currentConfig?.backupPath; }
|
||||
get backupPath(): string | undefined { return this._config?.backupPath; }
|
||||
|
||||
get openedWorkspace(): IWorkspaceIdentifier | ISingleFolderWorkspaceIdentifier | undefined { return this.currentConfig?.workspace; }
|
||||
get openedWorkspace(): IWorkspaceIdentifier | ISingleFolderWorkspaceIdentifier | undefined { return this._config?.workspace; }
|
||||
|
||||
get remoteAuthority(): string | undefined { return this.currentConfig?.remoteAuthority; }
|
||||
get remoteAuthority(): string | undefined { return this._config?.remoteAuthority; }
|
||||
|
||||
private currentConfig: INativeWindowConfiguration | undefined;
|
||||
get config(): INativeWindowConfiguration | undefined { return this.currentConfig; }
|
||||
private _config: INativeWindowConfiguration | undefined;
|
||||
get config(): INativeWindowConfiguration | undefined { return this._config; }
|
||||
|
||||
private hiddenTitleBarStyle: boolean | undefined;
|
||||
get hasHiddenTitleBarStyle(): boolean { return !!this.hiddenTitleBarStyle; }
|
||||
|
||||
get isExtensionDevelopmentHost(): boolean { return !!(this.currentConfig?.extensionDevelopmentPath); }
|
||||
get isExtensionDevelopmentHost(): boolean { return !!(this._config?.extensionDevelopmentPath); }
|
||||
|
||||
get isExtensionTestHost(): boolean { return !!(this.currentConfig?.extensionTestsPath); }
|
||||
get isExtensionTestHost(): boolean { return !!(this._config?.extensionTestsPath); }
|
||||
|
||||
get isExtensionDevelopmentTestFromCli(): boolean { return this.isExtensionDevelopmentHost && this.isExtensionTestHost && !this.currentConfig?.debugId; }
|
||||
get isExtensionDevelopmentTestFromCli(): boolean { return this.isExtensionDevelopmentHost && this.isExtensionTestHost && !this._config?.debugId; }
|
||||
|
||||
//#endregion
|
||||
|
||||
@@ -137,7 +138,6 @@ export class CodeWindow extends Disposable implements ICodeWindow {
|
||||
|
||||
private readonly touchBarGroups: TouchBarSegmentedControl[] = [];
|
||||
|
||||
private marketplaceHeadersPromise: Promise<object>;
|
||||
private currentHttpProxy: string | undefined = undefined;
|
||||
private currentNoProxy: string | undefined = undefined;
|
||||
|
||||
@@ -150,7 +150,8 @@ export class CodeWindow extends Disposable implements ICodeWindow {
|
||||
@ILogService private readonly logService: ILogService,
|
||||
@IEnvironmentMainService private readonly environmentMainService: IEnvironmentMainService,
|
||||
@IFileService private readonly fileService: IFileService,
|
||||
@IStorageMainService storageMainService: IStorageMainService,
|
||||
@IGlobalStorageMainService private readonly globalStorageMainService: IGlobalStorageMainService,
|
||||
@IStorageMainService private readonly storageMainService: IStorageMainService,
|
||||
@IConfigurationService private readonly configurationService: IConfigurationService,
|
||||
@IThemeMainService private readonly themeMainService: IThemeMainService,
|
||||
@IWorkspacesManagementMainService private readonly workspacesManagementMainService: IWorkspacesManagementMainService,
|
||||
@@ -176,7 +177,7 @@ export class CodeWindow extends Disposable implements ICodeWindow {
|
||||
|
||||
const windowSettings = this.configurationService.getValue<IWindowSettings | undefined>('window');
|
||||
|
||||
const options: BrowserWindowConstructorOptions = {
|
||||
const options: BrowserWindowConstructorOptions & { experimentalDarkMode: boolean } = {
|
||||
width: this.windowState.width,
|
||||
height: this.windowState.height,
|
||||
x: this.windowState.x,
|
||||
@@ -194,6 +195,9 @@ export class CodeWindow extends Disposable implements ICodeWindow {
|
||||
spellcheck: false,
|
||||
nativeWindowOpen: true,
|
||||
zoomFactor: zoomLevelToZoomFactor(windowSettings?.zoomLevel),
|
||||
// Enable experimental css highlight api https://chromestatus.com/feature/5436441440026624
|
||||
// Refs https://github.com/microsoft/vscode/issues/140098
|
||||
enableBlinkFeatures: 'HighlightAPI',
|
||||
...this.environmentMainService.sandbox ?
|
||||
|
||||
// Sandbox
|
||||
@@ -206,7 +210,8 @@ export class CodeWindow extends Disposable implements ICodeWindow {
|
||||
nodeIntegration: true,
|
||||
contextIsolation: false
|
||||
}
|
||||
}
|
||||
},
|
||||
experimentalDarkMode: true
|
||||
};
|
||||
|
||||
// Apply icon to window
|
||||
@@ -242,6 +247,19 @@ export class CodeWindow extends Disposable implements ICodeWindow {
|
||||
if (!isMacintosh) {
|
||||
options.frame = false;
|
||||
}
|
||||
|
||||
if (isWindows) {
|
||||
// This logic will not perfectly guess the right colors to use on initialization,
|
||||
// but prefer to keep things simple as it is temporary and not noticeable
|
||||
const titleBarColor = this.themeMainService.getWindowSplash()?.colorInfo.titleBarBackground ?? this.themeMainService.getBackgroundColor();
|
||||
const symbolColor = Color.fromHex(titleBarColor).isDarker() ? '#FFFFFF' : '#000000';
|
||||
|
||||
options.titleBarOverlay = {
|
||||
height: 29, // The smallest size of the title bar on windows accounting for the border on windows 11
|
||||
color: titleBarColor,
|
||||
symbolColor
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// Create the browser window
|
||||
@@ -303,12 +321,6 @@ export class CodeWindow extends Disposable implements ICodeWindow {
|
||||
// macOS: touch bar support
|
||||
this.createTouchBar();
|
||||
|
||||
// Request handling
|
||||
this.marketplaceHeadersPromise = resolveMarketplaceHeaders(this.productService.version, this.productService, this.environmentMainService, this.configurationService, this.fileService, {
|
||||
get: key => storageMainService.globalStorage.get(key),
|
||||
store: (key, value) => storageMainService.globalStorage.set(key, value)
|
||||
});
|
||||
|
||||
// Eventing
|
||||
this.registerListeners();
|
||||
}
|
||||
@@ -371,6 +383,8 @@ export class CodeWindow extends Disposable implements ICodeWindow {
|
||||
private readyState = ReadyState.NONE;
|
||||
|
||||
setReady(): void {
|
||||
this.logService.trace(`window#load: window reported ready (id: ${this._id})`);
|
||||
|
||||
this.readyState = ReadyState.READY;
|
||||
|
||||
// inform all waiting promises that we are ready now
|
||||
@@ -435,68 +449,12 @@ export class CodeWindow extends Disposable implements ICodeWindow {
|
||||
this.dispose();
|
||||
});
|
||||
|
||||
// Block all SVG requests from unsupported origins
|
||||
const supportedSvgSchemes = new Set([Schemas.file, Schemas.vscodeFileResource, Schemas.vscodeRemoteResource, 'devtools']);
|
||||
|
||||
// But allow them if the are made from inside an webview
|
||||
const isSafeFrame = (requestFrame: WebFrameMain | undefined): boolean => {
|
||||
for (let frame: WebFrameMain | null | undefined = requestFrame; frame; frame = frame.parent) {
|
||||
if (frame.url.startsWith(`${Schemas.vscodeWebview}://`)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
const isRequestFromSafeContext = (details: Electron.OnBeforeRequestListenerDetails | Electron.OnHeadersReceivedListenerDetails): boolean => {
|
||||
return details.resourceType === 'xhr' || isSafeFrame(details.frame);
|
||||
};
|
||||
|
||||
this._win.webContents.session.webRequest.onBeforeRequest((details, callback) => {
|
||||
const uri = URI.parse(details.url);
|
||||
if (uri.path.endsWith('.svg')) {
|
||||
const isSafeResourceUrl = supportedSvgSchemes.has(uri.scheme);
|
||||
if (!isSafeResourceUrl) {
|
||||
return callback({ cancel: !isRequestFromSafeContext(details) });
|
||||
}
|
||||
}
|
||||
|
||||
return callback({ cancel: false });
|
||||
});
|
||||
|
||||
// Configure SVG header content type properly
|
||||
// https://github.com/microsoft/vscode/issues/97564
|
||||
this._win.webContents.session.webRequest.onHeadersReceived((details, callback) => {
|
||||
const responseHeaders = details.responseHeaders as Record<string, (string) | (string[])>;
|
||||
const contentTypes = (responseHeaders['content-type'] || responseHeaders['Content-Type']);
|
||||
|
||||
if (contentTypes && Array.isArray(contentTypes)) {
|
||||
const uri = URI.parse(details.url);
|
||||
if (uri.path.endsWith('.svg')) {
|
||||
if (supportedSvgSchemes.has(uri.scheme)) {
|
||||
responseHeaders['Content-Type'] = ['image/svg+xml'];
|
||||
|
||||
return callback({ cancel: false, responseHeaders });
|
||||
}
|
||||
}
|
||||
|
||||
// remote extension schemes have the following format
|
||||
// http://127.0.0.1:<port>/vscode-remote-resource?path=
|
||||
if (!uri.path.includes(Schemas.vscodeRemoteResource) && contentTypes.some(contentType => contentType.toLowerCase().includes('image/svg'))) {
|
||||
return callback({ cancel: !isRequestFromSafeContext(details) });
|
||||
}
|
||||
}
|
||||
|
||||
return callback({ cancel: false });
|
||||
});
|
||||
|
||||
// Remember that we loaded
|
||||
this._win.webContents.on('did-finish-load', () => {
|
||||
this.readyState = ReadyState.LOADING;
|
||||
|
||||
// Associate properties from the load request if provided
|
||||
if (this.pendingLoadConfig) {
|
||||
this.currentConfig = this.pendingLoadConfig;
|
||||
this._config = this.pendingLoadConfig;
|
||||
|
||||
this.pendingLoadConfig = undefined;
|
||||
}
|
||||
@@ -509,16 +467,16 @@ export class CodeWindow extends Disposable implements ICodeWindow {
|
||||
|
||||
// Window (Un)Maximize
|
||||
this._win.on('maximize', (e: Event) => {
|
||||
if (this.currentConfig) {
|
||||
this.currentConfig.maximized = true;
|
||||
if (this._config) {
|
||||
this._config.maximized = true;
|
||||
}
|
||||
|
||||
app.emit('browser-window-maximize', e, this._win);
|
||||
});
|
||||
|
||||
this._win.on('unmaximize', (e: Event) => {
|
||||
if (this.currentConfig) {
|
||||
this.currentConfig.maximized = false;
|
||||
if (this._config) {
|
||||
this._config.maximized = false;
|
||||
}
|
||||
|
||||
app.emit('browser-window-unmaximize', e, this._win);
|
||||
@@ -542,16 +500,25 @@ export class CodeWindow extends Disposable implements ICodeWindow {
|
||||
// Inject headers when requests are incoming
|
||||
const urls = ['https://marketplace.visualstudio.com/*', 'https://*.vsassets.io/*'];
|
||||
this._win.webContents.session.webRequest.onBeforeSendHeaders({ urls }, async (details, cb) => {
|
||||
const headers = await this.marketplaceHeadersPromise;
|
||||
const headers = await this.getMarketplaceHeaders();
|
||||
|
||||
cb({ cancel: false, requestHeaders: Object.assign(details.requestHeaders, headers) });
|
||||
});
|
||||
}
|
||||
|
||||
private marketplaceHeadersPromise: Promise<object> | undefined;
|
||||
private getMarketplaceHeaders(): Promise<object> {
|
||||
if (!this.marketplaceHeadersPromise) {
|
||||
this.marketplaceHeadersPromise = resolveMarketplaceHeaders(this.productService.version, this.productService, this.environmentMainService, this.configurationService, this.fileService, this.globalStorageMainService);
|
||||
}
|
||||
|
||||
return this.marketplaceHeadersPromise;
|
||||
}
|
||||
|
||||
private async onWindowError(error: WindowError.UNRESPONSIVE): Promise<void>;
|
||||
private async onWindowError(error: WindowError.CRASHED, details: { reason: string, exitCode: number }): Promise<void>;
|
||||
private async onWindowError(error: WindowError.LOAD, details: { reason: string, exitCode: number }): Promise<void>;
|
||||
private async onWindowError(type: WindowError, details?: { reason: string, exitCode: number }): Promise<void> {
|
||||
private async onWindowError(error: WindowError.CRASHED, details: { reason: string; exitCode: number }): Promise<void>;
|
||||
private async onWindowError(error: WindowError.LOAD, details: { reason: string; exitCode: number }): Promise<void>;
|
||||
private async onWindowError(type: WindowError, details?: { reason: string; exitCode: number }): Promise<void> {
|
||||
|
||||
switch (type) {
|
||||
case WindowError.CRASHED:
|
||||
@@ -567,9 +534,11 @@ export class CodeWindow extends Disposable implements ICodeWindow {
|
||||
|
||||
// Telemetry
|
||||
type WindowErrorClassification = {
|
||||
type: { classification: 'SystemMetaData', purpose: 'PerformanceAndHealth', isMeasurement: true };
|
||||
reason: { classification: 'SystemMetaData', purpose: 'PerformanceAndHealth', isMeasurement: true };
|
||||
code: { classification: 'SystemMetaData', purpose: 'PerformanceAndHealth', isMeasurement: true };
|
||||
type: { classification: 'SystemMetaData'; purpose: 'PerformanceAndHealth'; isMeasurement: true; comment: 'The type of window crash to understand the nature of the crash better.' };
|
||||
reason: { classification: 'SystemMetaData'; purpose: 'PerformanceAndHealth'; isMeasurement: true; comment: 'The reason of the window crash to understand the nature of the crash better.' };
|
||||
code: { classification: 'SystemMetaData'; purpose: 'PerformanceAndHealth'; isMeasurement: true; omment: 'The exit code of the window process to understand the nature of the crash better' };
|
||||
owner: 'bpasero';
|
||||
comment: 'Provides insight into reasons the vscode window crashes.';
|
||||
};
|
||||
type WindowErrorEvent = {
|
||||
type: WindowError;
|
||||
@@ -591,6 +560,12 @@ export class CodeWindow extends Disposable implements ICodeWindow {
|
||||
return;
|
||||
}
|
||||
|
||||
// If we run smoke tests, we never want to show a blocking dialog
|
||||
if (this.environmentMainService.args['enable-smoke-test-driver']) {
|
||||
this.destroyWindow(false, false);
|
||||
return;
|
||||
}
|
||||
|
||||
// Unresponsive
|
||||
if (type === WindowError.UNRESPONSIVE) {
|
||||
if (this.isExtensionDevelopmentHost || this.isExtensionTestHost || (this._win && this._win.webContents && this._win.webContents.isDevToolsOpened())) {
|
||||
@@ -616,13 +591,14 @@ export class CodeWindow extends Disposable implements ICodeWindow {
|
||||
detail: localize('appStalledDetail', "You can reopen or close the window or keep waiting."),
|
||||
noLink: true,
|
||||
defaultId: 0,
|
||||
cancelId: 1
|
||||
cancelId: 1,
|
||||
checkboxLabel: this._config?.workspace ? localize('doNotRestoreEditors', "Don't restore editors") : undefined
|
||||
}, this._win);
|
||||
|
||||
// Handle choice
|
||||
if (result.response !== 1 /* keep waiting */) {
|
||||
const reopen = result.response === 0;
|
||||
this.destroyWindow(reopen);
|
||||
this.destroyWindow(reopen, result.checkboxChecked);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -646,18 +622,32 @@ export class CodeWindow extends Disposable implements ICodeWindow {
|
||||
message,
|
||||
detail: localize('appCrashedDetail', "We are sorry for the inconvenience. You can reopen the window to continue where you left off."),
|
||||
noLink: true,
|
||||
defaultId: 0
|
||||
defaultId: 0,
|
||||
checkboxLabel: this._config?.workspace ? localize('doNotRestoreEditors', "Don't restore editors") : undefined
|
||||
}, this._win);
|
||||
|
||||
// Handle choice
|
||||
const reopen = result.response === 0;
|
||||
this.destroyWindow(reopen);
|
||||
this.destroyWindow(reopen, result.checkboxChecked);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private destroyWindow(reopen: boolean): void {
|
||||
private async destroyWindow(reopen: boolean, skipRestoreEditors: boolean): Promise<void> {
|
||||
const workspace = this._config?.workspace;
|
||||
|
||||
// check to discard editor state first
|
||||
if (skipRestoreEditors && workspace) {
|
||||
try {
|
||||
const workspaceStorage = this.storageMainService.workspaceStorage(workspace);
|
||||
await workspaceStorage.init();
|
||||
workspaceStorage.delete('memento/workbench.parts.editor');
|
||||
await workspaceStorage.close();
|
||||
} catch (error) {
|
||||
this.logService.error(error);
|
||||
}
|
||||
}
|
||||
|
||||
// 'close' event will not be fired on destroy(), so signal crash via explicit event
|
||||
this._onDidDestroy.fire();
|
||||
@@ -666,15 +656,15 @@ export class CodeWindow extends Disposable implements ICodeWindow {
|
||||
this._win?.destroy();
|
||||
|
||||
// ask the windows service to open a new fresh window if specified
|
||||
if (reopen && this.config) {
|
||||
if (reopen && this._config) {
|
||||
|
||||
// We have to reconstruct a openable from the current workspace
|
||||
let workspace: IWorkspaceToOpen | IFolderToOpen | undefined = undefined;
|
||||
let uriToOpen: IWorkspaceToOpen | IFolderToOpen | undefined = undefined;
|
||||
let forceEmpty = undefined;
|
||||
if (isSingleFolderWorkspaceIdentifier(this.openedWorkspace)) {
|
||||
workspace = { folderUri: this.openedWorkspace.uri };
|
||||
} else if (isWorkspaceIdentifier(this.openedWorkspace)) {
|
||||
workspace = { workspaceUri: this.openedWorkspace.configPath };
|
||||
if (isSingleFolderWorkspaceIdentifier(workspace)) {
|
||||
uriToOpen = { folderUri: workspace.uri };
|
||||
} else if (isWorkspaceIdentifier(workspace)) {
|
||||
uriToOpen = { workspaceUri: workspace.configPath };
|
||||
} else {
|
||||
forceEmpty = true;
|
||||
}
|
||||
@@ -682,14 +672,15 @@ export class CodeWindow extends Disposable implements ICodeWindow {
|
||||
// Delegate to windows service
|
||||
const [window] = this.windowsMainService.open({
|
||||
context: OpenContext.API,
|
||||
userEnv: this.config.userEnv,
|
||||
userEnv: this._config.userEnv,
|
||||
cli: {
|
||||
...this.environmentMainService.args,
|
||||
_: [] // we pass in the workspace to open explicitly via `urisToOpen`
|
||||
},
|
||||
urisToOpen: workspace ? [workspace] : undefined,
|
||||
urisToOpen: uriToOpen ? [uriToOpen] : undefined,
|
||||
forceEmpty,
|
||||
forceNewWindow: true
|
||||
forceNewWindow: true,
|
||||
remoteAuthority: this.remoteAuthority
|
||||
});
|
||||
window.focus();
|
||||
}
|
||||
@@ -699,8 +690,8 @@ export class CodeWindow extends Disposable implements ICodeWindow {
|
||||
|
||||
// Make sure to update our workspace config if we detect that it
|
||||
// was deleted
|
||||
if (this.openedWorkspace?.id === workspace.id && this.currentConfig) {
|
||||
this.currentConfig.workspace = undefined;
|
||||
if (this._config?.workspace?.id === workspace.id && this._config) {
|
||||
this._config.workspace = undefined;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -741,6 +732,7 @@ export class CodeWindow extends Disposable implements ICodeWindow {
|
||||
}
|
||||
|
||||
load(configuration: INativeWindowConfiguration, options: ILoadOptions = Object.create(null)): void {
|
||||
this.logService.trace(`window#load: attempt to load window (id: ${this._id})`);
|
||||
|
||||
// Clear Document Edited if needed
|
||||
if (this.isDocumentEdited()) {
|
||||
@@ -765,7 +757,7 @@ export class CodeWindow extends Disposable implements ICodeWindow {
|
||||
// If this is the first time the window is loaded, we associate the paths
|
||||
// directly with the window because we assume the loading will just work
|
||||
if (this.readyState === ReadyState.NONE) {
|
||||
this.currentConfig = configuration;
|
||||
this._config = configuration;
|
||||
}
|
||||
|
||||
// Otherwise, the window is currently showing a folder and if there is an
|
||||
@@ -774,9 +766,11 @@ export class CodeWindow extends Disposable implements ICodeWindow {
|
||||
// the window load event has fired.
|
||||
else {
|
||||
this.pendingLoadConfig = configuration;
|
||||
this.readyState = ReadyState.NAVIGATING;
|
||||
}
|
||||
|
||||
// Indicate we are navigting now
|
||||
this.readyState = ReadyState.NAVIGATING;
|
||||
|
||||
// Load URL
|
||||
this._win.loadURL(FileAccess.asBrowserUri(this.environmentMainService.sandbox ?
|
||||
'vs/code/electron-sandbox/workbench/workbench.html' :
|
||||
@@ -814,7 +808,7 @@ export class CodeWindow extends Disposable implements ICodeWindow {
|
||||
// Also, preserve the environment if we're loading from an
|
||||
// extension development host that had its environment set
|
||||
// (for https://github.com/microsoft/vscode/issues/123508)
|
||||
const currentUserEnv = (this.currentConfig ?? this.pendingLoadConfig)?.userEnv;
|
||||
const currentUserEnv = (this._config ?? this.pendingLoadConfig)?.userEnv;
|
||||
if (currentUserEnv) {
|
||||
const shouldPreserveLaunchCliEnvironment = isLaunchedFromCli(currentUserEnv) && !isLaunchedFromCli(configuration.userEnv);
|
||||
const shouldPreserveDebugEnvironmnet = this.isExtensionDevelopmentHost;
|
||||
@@ -854,7 +848,7 @@ export class CodeWindow extends Disposable implements ICodeWindow {
|
||||
async reload(cli?: NativeParsedArgs): Promise<void> {
|
||||
|
||||
// Copy our current config for reuse
|
||||
const configuration = Object.assign({}, this.currentConfig);
|
||||
const configuration = Object.assign({}, this._config);
|
||||
|
||||
// Validate workspace
|
||||
configuration.workspace = await this.validateWorkspaceBeforeReload(configuration);
|
||||
|
||||
Reference in New Issue
Block a user