mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-10 18:22:34 -05:00
Merge from vscode 4d91d96e5e121b38d33508cdef17868bab255eae
This commit is contained in:
committed by
AzureDataStudio
parent
a971aee5bd
commit
5e7071e466
@@ -15,7 +15,7 @@ import { ParsedArgs } from 'vs/platform/environment/node/argv';
|
||||
import { INativeEnvironmentService } from 'vs/platform/environment/node/environmentService';
|
||||
import { IStateService } from 'vs/platform/state/node/state';
|
||||
import { CodeWindow, defaultWindowState } from 'vs/code/electron-main/window';
|
||||
import { ipcMain as ipc, screen, BrowserWindow, MessageBoxOptions, Display, app, nativeTheme } from 'electron';
|
||||
import { screen, BrowserWindow, MessageBoxOptions, Display, app, nativeTheme } from 'electron';
|
||||
import { ILifecycleMainService, UnloadReason, LifecycleMainService, LifecycleMainPhase } from 'vs/platform/lifecycle/electron-main/lifecycleMainService';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
@@ -30,7 +30,7 @@ import { IWorkspaceIdentifier, isSingleFolderWorkspaceIdentifier, hasWorkspaceFi
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { Schemas } from 'vs/base/common/network';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { getComparisonKey, isEqual, normalizePath, originalFSPath, removeTrailingPathSeparator } from 'vs/base/common/resources';
|
||||
import { normalizePath, originalFSPath, removeTrailingPathSeparator, extUriBiasedIgnorePathCase } from 'vs/base/common/resources';
|
||||
import { getRemoteAuthority } from 'vs/platform/remote/common/remoteHosts';
|
||||
import { restoreWindowsState, WindowsStateStorageData, getWindowsStateStoreData } from 'vs/platform/windows/electron-main/windowsStateStorage';
|
||||
import { getWorkspaceIdentifier, IWorkspacesMainService } from 'vs/platform/workspaces/electron-main/workspacesMainService';
|
||||
@@ -152,7 +152,7 @@ interface IWorkspacePathToOpen {
|
||||
|
||||
export class WindowsMainService extends Disposable implements IWindowsMainService {
|
||||
|
||||
_serviceBrand: undefined;
|
||||
declare readonly _serviceBrand: undefined;
|
||||
|
||||
private static readonly windowsStateStorageKey = 'windowsState';
|
||||
|
||||
@@ -212,19 +212,6 @@ export class WindowsMainService extends Disposable implements IWindowsMainServic
|
||||
|
||||
private registerListeners(): void {
|
||||
|
||||
// React to workbench ready events from windows
|
||||
ipc.on('vscode:workbenchReady', (event: Event, windowId: number) => {
|
||||
this.logService.trace('IPC#vscode-workbenchReady');
|
||||
|
||||
const win = this.getWindowById(windowId);
|
||||
if (win) {
|
||||
win.setReady();
|
||||
|
||||
// Event
|
||||
this._onWindowReady.fire(win);
|
||||
}
|
||||
});
|
||||
|
||||
// React to HC color scheme changes (Windows)
|
||||
if (isWindows) {
|
||||
nativeTheme.on('updated', () => {
|
||||
@@ -365,7 +352,7 @@ export class WindowsMainService extends Disposable implements IWindowsMainServic
|
||||
else if (!win.isExtensionDevelopmentHost && (!!win.openedWorkspace || !!win.openedFolderUri)) {
|
||||
this.windowsState.openedWindows.forEach(o => {
|
||||
const sameWorkspace = win.openedWorkspace && o.workspace && o.workspace.id === win.openedWorkspace.id;
|
||||
const sameFolder = win.openedFolderUri && o.folderUri && isEqual(o.folderUri, win.openedFolderUri);
|
||||
const sameFolder = win.openedFolderUri && o.folderUri && extUriBiasedIgnorePathCase.isEqual(o.folderUri, win.openedFolderUri);
|
||||
|
||||
if (sameWorkspace || sameFolder) {
|
||||
o.uiState = state.uiState;
|
||||
@@ -673,7 +660,7 @@ export class WindowsMainService extends Disposable implements IWindowsMainServic
|
||||
}
|
||||
|
||||
// Handle folders to open (instructed and to restore)
|
||||
const allFoldersToOpen = arrays.distinct(foldersToOpen, folder => getComparisonKey(folder.folderUri)); // prevent duplicates
|
||||
const allFoldersToOpen = arrays.distinct(foldersToOpen, folder => extUriBiasedIgnorePathCase.getComparisonKey(folder.folderUri)); // prevent duplicates
|
||||
if (allFoldersToOpen.length > 0) {
|
||||
|
||||
// Check for existing instances
|
||||
@@ -696,7 +683,7 @@ export class WindowsMainService extends Disposable implements IWindowsMainServic
|
||||
// Open remaining ones
|
||||
allFoldersToOpen.forEach(folderToOpen => {
|
||||
|
||||
if (windowsOnFolderPath.some(win => isEqual(win.openedFolderUri, folderToOpen.folderUri))) {
|
||||
if (windowsOnFolderPath.some(win => extUriBiasedIgnorePathCase.isEqual(win.openedFolderUri, folderToOpen.folderUri))) {
|
||||
return; // ignore folders that are already open
|
||||
}
|
||||
|
||||
@@ -1434,24 +1421,25 @@ export class WindowsMainService extends Disposable implements IWindowsMainServic
|
||||
if (options.forceNewTabbedWindow) {
|
||||
const activeWindow = this.getLastActiveWindow();
|
||||
if (activeWindow) {
|
||||
activeWindow.addTabbedWindow(window);
|
||||
activeWindow.addTabbedWindow(createdWindow);
|
||||
}
|
||||
}
|
||||
|
||||
// Add to our list of windows
|
||||
WindowsMainService.WINDOWS.push(window);
|
||||
WindowsMainService.WINDOWS.push(createdWindow);
|
||||
|
||||
// Indicate number change via event
|
||||
this._onWindowsCountChanged.fire({ oldCount: WindowsMainService.WINDOWS.length - 1, newCount: WindowsMainService.WINDOWS.length });
|
||||
|
||||
// Window Events
|
||||
once(window.onClose)(() => this.onWindowClosed(createdWindow));
|
||||
once(window.onDestroy)(() => this.onBeforeWindowClose(createdWindow)); // try to save state before destroy because close will not fire
|
||||
window.win.webContents.removeAllListeners('devtools-reload-page'); // remove built in listener so we can handle this on our own
|
||||
window.win.webContents.on('devtools-reload-page', () => this.lifecycleMainService.reload(createdWindow));
|
||||
once(createdWindow.onReady)(() => this._onWindowReady.fire(createdWindow));
|
||||
once(createdWindow.onClose)(() => this.onWindowClosed(createdWindow));
|
||||
once(createdWindow.onDestroy)(() => this.onBeforeWindowClose(createdWindow)); // try to save state before destroy because close will not fire
|
||||
createdWindow.win.webContents.removeAllListeners('devtools-reload-page'); // remove built in listener so we can handle this on our own
|
||||
createdWindow.win.webContents.on('devtools-reload-page', () => this.lifecycleMainService.reload(createdWindow));
|
||||
|
||||
// Lifecycle
|
||||
(this.lifecycleMainService as LifecycleMainService).registerWindow(window);
|
||||
(this.lifecycleMainService as LifecycleMainService).registerWindow(createdWindow);
|
||||
}
|
||||
|
||||
// Existing window
|
||||
@@ -1526,7 +1514,7 @@ export class WindowsMainService extends Disposable implements IWindowsMainServic
|
||||
|
||||
// Known Folder - load from stored settings
|
||||
if (configuration.folderUri) {
|
||||
const stateForFolder = this.windowsState.openedWindows.filter(o => o.folderUri && isEqual(o.folderUri, configuration.folderUri)).map(o => o.uiState);
|
||||
const stateForFolder = this.windowsState.openedWindows.filter(o => o.folderUri && extUriBiasedIgnorePathCase.isEqual(o.folderUri, configuration.folderUri)).map(o => o.uiState);
|
||||
if (stateForFolder.length) {
|
||||
return stateForFolder[0];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user