Merge from vscode e0762af258c0b20320ed03f3871a41967acc4421 (#7404)

* Merge from vscode e0762af258c0b20320ed03f3871a41967acc4421

* readd svgs
This commit is contained in:
Anthony Dresser
2019-09-27 11:13:19 -07:00
committed by GitHub
parent 6385443a4c
commit 07109617b5
348 changed files with 4219 additions and 4307 deletions

View File

@@ -5,7 +5,6 @@
import { URI } from 'vs/base/common/uri';
import { Action } from 'vs/base/common/actions';
import { IWindowService, IWindowsService } from 'vs/platform/windows/common/windows';
import * as nls from 'vs/nls';
import * as browser from 'vs/base/browser/browser';
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
@@ -19,6 +18,7 @@ import { ICommandHandler } from 'vs/platform/commands/common/commands';
import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { IElectronService } from 'vs/platform/electron/node/electron';
import { IElectronEnvironmentService } from 'vs/workbench/services/electron/electron-browser/electronEnvironmentService';
export class CloseCurrentWindowAction extends Action {
@@ -167,8 +167,7 @@ export abstract class BaseSwitchWindow extends Action {
constructor(
id: string,
label: string,
private windowsService: IWindowsService,
private windowService: IWindowService,
private electronEnvironmentService: IElectronEnvironmentService,
private quickInputService: IQuickInputService,
private keybindingService: IKeybindingService,
private modelService: IModelService,
@@ -176,15 +175,14 @@ export abstract class BaseSwitchWindow extends Action {
private electronService: IElectronService
) {
super(id, label);
}
protected abstract isQuickNavigate(): boolean;
async run(): Promise<void> {
const currentWindowId = this.windowService.windowId;
const currentWindowId = this.electronEnvironmentService.windowId;
const windows = await this.windowsService.getWindows();
const windows = await this.electronService.getWindows();
const placeHolder = nls.localize('switchWindowPlaceHolder', "Select a window to switch to");
const picks = windows.map(win => {
const resource = win.filename ? URI.file(win.filename) : win.folderUri ? win.folderUri : win.workspace ? win.workspace.configPath : undefined;
@@ -211,7 +209,7 @@ export abstract class BaseSwitchWindow extends Action {
});
if (pick) {
this.windowsService.focusWindow(pick.payload);
this.electronService.focusWindow({ windowId: pick.payload });
}
}
}
@@ -224,15 +222,14 @@ export class SwitchWindow extends BaseSwitchWindow {
constructor(
id: string,
label: string,
@IWindowsService windowsService: IWindowsService,
@IWindowService windowService: IWindowService,
@IElectronEnvironmentService electronEnvironmentService: IElectronEnvironmentService,
@IQuickInputService quickInputService: IQuickInputService,
@IKeybindingService keybindingService: IKeybindingService,
@IModelService modelService: IModelService,
@IModeService modeService: IModeService,
@IElectronService electronService: IElectronService
) {
super(id, label, windowsService, windowService, quickInputService, keybindingService, modelService, modeService, electronService);
super(id, label, electronEnvironmentService, quickInputService, keybindingService, modelService, modeService, electronService);
}
protected isQuickNavigate(): boolean {
@@ -248,15 +245,14 @@ export class QuickSwitchWindow extends BaseSwitchWindow {
constructor(
id: string,
label: string,
@IWindowsService windowsService: IWindowsService,
@IWindowService windowService: IWindowService,
@IElectronEnvironmentService electronEnvironmentService: IElectronEnvironmentService,
@IQuickInputService quickInputService: IQuickInputService,
@IKeybindingService keybindingService: IKeybindingService,
@IModelService modelService: IModelService,
@IModeService modeService: IModeService,
@IElectronService electronService: IElectronService
) {
super(id, label, windowsService, windowService, quickInputService, keybindingService, modelService, modeService, electronService);
super(id, label, electronEnvironmentService, quickInputService, keybindingService, modelService, modeService, electronService);
}
protected isQuickNavigate(): boolean {

View File

@@ -5,7 +5,7 @@
import { Action } from 'vs/base/common/actions';
import * as nls from 'vs/nls';
import { IWindowService } from 'vs/platform/windows/common/windows';
import { IHostService } from 'vs/workbench/services/host/browser/host';
import { IWorkspaceContextService, WorkbenchState } from 'vs/platform/workspace/common/workspace';
import { IWorkspaceEditingService } from 'vs/workbench/services/workspace/common/workspaceEditing';
import { IWorkspacesService } from 'vs/platform/workspaces/common/workspaces';
@@ -51,7 +51,7 @@ export class DuplicateWorkspaceInNewWindowAction extends Action {
label: string,
@IWorkspaceContextService private readonly workspaceContextService: IWorkspaceContextService,
@IWorkspaceEditingService private readonly workspaceEditingService: IWorkspaceEditingService,
@IWindowService private readonly windowService: IWindowService,
@IHostService private readonly hostService: IHostService,
@IWorkspacesService private readonly workspacesService: IWorkspacesService,
@IWorkbenchEnvironmentService private readonly environmentService: IWorkbenchEnvironmentService
) {
@@ -65,6 +65,6 @@ export class DuplicateWorkspaceInNewWindowAction extends Action {
const newWorkspace = await this.workspacesService.createUntitledWorkspace(folders, remoteAuthority);
await this.workspaceEditingService.copyWorkspaceSettings(newWorkspace);
return this.windowService.openWindow([{ workspaceUri: newWorkspace.configPath }], { forceNewWindow: true });
return this.hostService.openInWindow([{ workspaceUri: newWorkspace.configPath }], { forceNewWindow: true });
}
}

View File

@@ -24,7 +24,7 @@ import { IWindowConfiguration } from 'vs/platform/windows/common/windows';
import { webFrame } from 'electron';
import { ISingleFolderWorkspaceIdentifier, IWorkspaceInitializationPayload, ISingleFolderWorkspaceInitializationPayload, reviveWorkspaceIdentifier } from 'vs/platform/workspaces/common/workspaces';
import { ConsoleLogService, MultiplexLogService, ILogService, ConsoleLogInMainService } from 'vs/platform/log/common/log';
import { StorageService } from 'vs/platform/storage/node/storageService';
import { NativeStorageService } from 'vs/platform/storage/node/storageService';
import { LoggerChannelClient, FollowerLogService } from 'vs/platform/log/common/logIpc';
import { Schemas } from 'vs/base/common/network';
import { sanitizeFilePath } from 'vs/base/common/extpath';
@@ -44,7 +44,6 @@ import { IFileService } from 'vs/platform/files/common/files';
import { DiskFileSystemProvider } from 'vs/platform/files/electron-browser/diskFileSystemProvider';
import { IChannel } from 'vs/base/parts/ipc/common/ipc';
import { REMOTE_FILE_SYSTEM_CHANNEL_NAME, RemoteExtensionsFileSystemProvider } from 'vs/platform/remote/common/remoteAgentFileSystemChannel';
import { DefaultConfigurationExportHelper } from 'vs/workbench/services/configuration/node/configurationExportHelper';
import { ConfigurationCache } from 'vs/workbench/services/configuration/node/configurationCache';
import { SpdLogService } from 'vs/platform/log/node/spdlogService';
import { SignService } from 'vs/platform/sign/node/signService';
@@ -53,14 +52,16 @@ import { FileUserDataProvider } from 'vs/workbench/services/userData/common/file
import { basename } from 'vs/base/common/resources';
import { IProductService } from 'vs/platform/product/common/productService';
import product from 'vs/platform/product/common/product';
import { ElectronEnvironmentService, IElectronEnvironmentService } from 'vs/workbench/services/electron/electron-browser/electronEnvironmentService';
class CodeRendererMain extends Disposable {
class DesktopMain extends Disposable {
private readonly environmentService: WorkbenchEnvironmentService;
constructor(configuration: IWindowConfiguration) {
constructor(private configuration: IWindowConfiguration) {
super();
this.environmentService = new WorkbenchEnvironmentService(configuration, configuration.execPath);
this.environmentService = new WorkbenchEnvironmentService(configuration, configuration.execPath, configuration.windowId);
this.init();
}
@@ -113,18 +114,15 @@ class CodeRendererMain extends Disposable {
async open(): Promise<void> {
const services = await this.initServices();
await domContentLoaded();
mark('willStartWorkbench');
// Create Workbench
const workbench = new Workbench(document.body, services.serviceCollection, services.logService);
// Layout
this._register(addDisposableListener(window, EventType.RESIZE, e => this.onWindowResize(e, true, workbench)));
// Workbench Lifecycle
this._register(workbench.onShutdown(() => this.dispose()));
this._register(workbench.onWillShutdown(event => event.join(services.storageService.close())));
// Listeners
this.registerListeners(workbench, services.storageService);
// Startup
const instantiationService = workbench.startup();
@@ -134,18 +132,23 @@ class CodeRendererMain extends Disposable {
// Driver
if (this.environmentService.configuration.driver) {
instantiationService.invokeFunction(async accessor => this._register(await registerWindowDriver(accessor)));
}
// Config Exporter
if (this.environmentService.configuration['export-default-configuration']) {
instantiationService.createInstance(DefaultConfigurationExportHelper);
instantiationService.invokeFunction(async accessor => this._register(await registerWindowDriver(accessor, this.configuration.windowId)));
}
// Logging
services.logService.trace('workbench configuration', JSON.stringify(this.environmentService.configuration));
}
private registerListeners(workbench: Workbench, storageService: NativeStorageService): void {
// Layout
this._register(addDisposableListener(window, EventType.RESIZE, e => this.onWindowResize(e, true, workbench)));
// Workbench Lifecycle
this._register(workbench.onShutdown(() => this.dispose()));
this._register(workbench.onWillShutdown(event => event.join(storageService.close())));
}
private onWindowResize(e: Event, retry: boolean, workbench: Workbench): void {
if (e.target === window) {
if (window.document && window.document.body && window.document.body.clientWidth === 0) {
@@ -164,7 +167,7 @@ class CodeRendererMain extends Disposable {
}
}
private async initServices(): Promise<{ serviceCollection: ServiceCollection, logService: ILogService, storageService: StorageService }> {
private async initServices(): Promise<{ serviceCollection: ServiceCollection, logService: ILogService, storageService: NativeStorageService }> {
const serviceCollection = new ServiceCollection();
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@@ -173,11 +176,15 @@ class CodeRendererMain extends Disposable {
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
// Main Process
const mainProcessService = this._register(new MainProcessService(this.environmentService.configuration.windowId));
const mainProcessService = this._register(new MainProcessService(this.configuration.windowId));
serviceCollection.set(IMainProcessService, mainProcessService);
// Environment
serviceCollection.set(IWorkbenchEnvironmentService, this.environmentService);
serviceCollection.set(IElectronEnvironmentService, new ElectronEnvironmentService(
this.configuration.windowId,
this.environmentService.sharedIPCHandle
));
// Product
serviceCollection.set(IProductService, { _serviceBrand: undefined, ...product });
@@ -328,9 +335,9 @@ class CodeRendererMain extends Disposable {
}
}
private async createStorageService(payload: IWorkspaceInitializationPayload, logService: ILogService, mainProcessService: IMainProcessService): Promise<StorageService> {
private async createStorageService(payload: IWorkspaceInitializationPayload, logService: ILogService, mainProcessService: IMainProcessService): Promise<NativeStorageService> {
const globalStorageDatabase = new GlobalStorageDatabaseChannelClient(mainProcessService.getChannel('storage'));
const storageService = new StorageService(globalStorageDatabase, logService, this.environmentService);
const storageService = new NativeStorageService(globalStorageDatabase, logService, this.environmentService);
try {
await storageService.initialize(payload);
@@ -359,7 +366,7 @@ class CodeRendererMain extends Disposable {
else {
loggers.push(
new ConsoleLogService(this.environmentService.configuration.logLevel),
new SpdLogService(`renderer${this.environmentService.configuration.windowId}`, environmentService.logsPath, this.environmentService.configuration.logLevel)
new SpdLogService(`renderer${this.configuration.windowId}`, environmentService.logsPath, this.environmentService.configuration.logLevel)
);
}
@@ -368,7 +375,7 @@ class CodeRendererMain extends Disposable {
}
export function main(configuration: IWindowConfiguration): Promise<void> {
const renderer = new CodeRendererMain(configuration);
const renderer = new DesktopMain(configuration);
return renderer.open();
}

View File

@@ -14,7 +14,7 @@ import { IFileService } from 'vs/platform/files/common/files';
import { toResource, IUntitledResourceInput, SideBySideEditor, pathsToEditors } from 'vs/workbench/common/editor';
import { IEditorService, IResourceEditor } from 'vs/workbench/services/editor/common/editorService';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { IWindowsService, IWindowService, IWindowSettings, IOpenFileRequest, IWindowsConfiguration, IAddFoldersRequest, IRunActionInWindowRequest, IRunKeybindingInWindowRequest, getTitleBarStyle } from 'vs/platform/windows/common/windows';
import { IWindowSettings, IOpenFileRequest, IWindowsConfiguration, IAddFoldersRequest, IRunActionInWindowRequest, IRunKeybindingInWindowRequest, getTitleBarStyle } from 'vs/platform/windows/common/windows';
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
import { ITitleService } from 'vs/workbench/services/title/common/titleService';
import { IWorkbenchThemeService, VS_HC_THEME } from 'vs/workbench/services/themes/common/workbenchThemeService';
@@ -50,7 +50,6 @@ import { ILabelService } from 'vs/platform/label/common/label';
import { IUpdateService } from 'vs/platform/update/common/update';
import { IStorageService } from 'vs/platform/storage/common/storage';
import { IPreferencesService } from '../services/preferences/common/preferences';
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
import { IMenubarService, IMenubarData, IMenubarMenu, IMenubarKeybinding, IMenubarMenuItemSubmenu, IMenubarMenuItemAction, MenubarMenuItem } from 'vs/platform/menubar/node/menubar';
import { withNullAsUndefined } from 'vs/base/common/types';
import { IOpenerService, OpenOptions } from 'vs/platform/opener/common/opener';
@@ -60,6 +59,9 @@ import { posix, dirname } from 'vs/base/common/path';
import { getBaseLabel } from 'vs/base/common/labels';
import { ITunnelService, extractLocalHostUriMetaDataForPortMapping } from 'vs/platform/remote/common/tunnel';
import { IWorkbenchLayoutService, Parts } from 'vs/workbench/services/layout/browser/layoutService';
import { IHostService } from 'vs/workbench/services/host/browser/host';
import { IElectronEnvironmentService } from 'vs/workbench/services/electron/electron-browser/electronEnvironmentService';
import { IWorkspacesHistoryService } from 'vs/workbench/services/workspace/common/workspacesHistoryService';
const TextInputActions: IAction[] = [
new Action('undo', nls.localize('undo', "Undo"), undefined, true, () => Promise.resolve(document.execCommand('undo'))),
@@ -89,7 +91,6 @@ export class ElectronWindow extends Disposable {
constructor(
@IEditorService private readonly editorService: EditorServiceImpl,
@IWindowService private readonly windowService: IWindowService,
@IConfigurationService private readonly configurationService: IConfigurationService,
@ITitleService private readonly titleService: ITitleService,
@IWorkbenchThemeService protected themeService: IWorkbenchThemeService,
@@ -111,7 +112,8 @@ export class ElectronWindow extends Disposable {
@IOpenerService private readonly openerService: IOpenerService,
@IElectronService private readonly electronService: IElectronService,
@ITunnelService private readonly tunnelService: ITunnelService,
@IWorkbenchLayoutService private readonly layoutService: IWorkbenchLayoutService
@IWorkbenchLayoutService private readonly layoutService: IWorkbenchLayoutService,
@IElectronEnvironmentService private readonly electronEnvironmentService: IElectronEnvironmentService
) {
super();
@@ -389,7 +391,7 @@ export class ElectronWindow extends Disposable {
this.setupOpenHandlers();
// Emit event when vscode is ready
this.lifecycleService.when(LifecyclePhase.Ready).then(() => ipc.send('vscode:workbenchReady', this.windowService.windowId));
this.lifecycleService.when(LifecyclePhase.Ready).then(() => ipc.send('vscode:workbenchReady', this.electronEnvironmentService.windowId));
// Integrity warning
this.integrityService.isPure().then(res => this.titleService.updateProperties({ isPure: res.isPure }));
@@ -679,8 +681,7 @@ export class ElectronWindow extends Disposable {
class NativeMenubarControl extends MenubarControl {
constructor(
@IMenuService menuService: IMenuService,
@IWindowService windowService: IWindowService,
@IWindowsService windowsService: IWindowsService,
@IWorkspacesHistoryService workspacesHistoryService: IWorkspacesHistoryService,
@IContextKeyService contextKeyService: IContextKeyService,
@IKeybindingService keybindingService: IKeybindingService,
@IConfigurationService configurationService: IConfigurationService,
@@ -689,14 +690,15 @@ class NativeMenubarControl extends MenubarControl {
@IStorageService storageService: IStorageService,
@INotificationService notificationService: INotificationService,
@IPreferencesService preferencesService: IPreferencesService,
@IEnvironmentService environmentService: IEnvironmentService,
@IWorkbenchEnvironmentService environmentService: IWorkbenchEnvironmentService,
@IAccessibilityService accessibilityService: IAccessibilityService,
@IMenubarService private readonly menubarService: IMenubarService
@IMenubarService private readonly menubarService: IMenubarService,
@IHostService hostService: IHostService,
@IElectronEnvironmentService private readonly electronEnvironmentService: IElectronEnvironmentService
) {
super(
menuService,
windowService,
windowsService,
workspacesHistoryService,
contextKeyService,
keybindingService,
configurationService,
@@ -706,7 +708,9 @@ class NativeMenubarControl extends MenubarControl {
notificationService,
preferencesService,
environmentService,
accessibilityService);
accessibilityService,
hostService
);
if (isMacintosh) {
this.menus['Preferences'] = this._register(this.menuService.createMenu(MenuId.MenubarPreferencesMenu, this.contextKeyService));
@@ -720,11 +724,11 @@ class NativeMenubarControl extends MenubarControl {
}
}
this.windowService.getRecentlyOpened().then((recentlyOpened) => {
this.recentlyOpened = recentlyOpened;
(async () => {
this.recentlyOpened = await this.workspacesHistoryService.getRecentlyOpened();
this.doUpdateMenubar(true);
});
})();
this.registerListeners();
}
@@ -734,7 +738,7 @@ class NativeMenubarControl extends MenubarControl {
// Send menus to main process to be rendered by Electron
const menubarData = { menus: {}, keybindings: {} };
if (this.getMenubarMenus(menubarData)) {
this.menubarService.updateMenubar(this.windowService.windowId, menubarData);
this.menubarService.updateMenubar(this.electronEnvironmentService.windowId, menubarData);
}
}