diff --git a/src/vs/workbench/electron-browser/workbench.ts b/src/vs/workbench/browser/workbench.ts similarity index 98% rename from src/vs/workbench/electron-browser/workbench.ts rename to src/vs/workbench/browser/workbench.ts index 23463182bfd2e..ed88665fd55f8 100644 --- a/src/vs/workbench/electron-browser/workbench.ts +++ b/src/vs/workbench/browser/workbench.ts @@ -37,7 +37,7 @@ import { ITitleService } from 'vs/workbench/services/title/common/titleService'; import { IInstantiationService, ServicesAccessor, ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation'; import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection'; import { LifecyclePhase, StartupKind, ILifecycleService, WillShutdownEvent } from 'vs/platform/lifecycle/common/lifecycle'; -import { IWindowService, IWindowConfiguration, IPath, MenuBarVisibility, getTitleBarStyle } from 'vs/platform/windows/common/windows'; +import { IWindowService, IPath, MenuBarVisibility, getTitleBarStyle } from 'vs/platform/windows/common/windows'; import { IEnvironmentService } from 'vs/platform/environment/common/environment'; import { INotificationService } from 'vs/platform/notification/common/notification'; import { NotificationService } from 'vs/workbench/services/notification/common/notificationService'; @@ -62,6 +62,10 @@ import { Part } from 'vs/workbench/browser/part'; import { IStatusbarService } from 'vs/platform/statusbar/common/statusbar'; import { IActivityBarService } from 'vs/workbench/services/activityBar/browser/activityBarService'; +export interface IWorkbenchOptions { + hasInitialFilesToOpen: boolean; +} + enum Settings { MENUBAR_VISIBLE = 'window.menuBarVisibility', ACTIVITYBAR_VISIBLE = 'workbench.activityBar.visible', @@ -115,7 +119,7 @@ export class Workbench extends Disposable implements IWorkbenchLayoutService { constructor( private parent: HTMLElement, - private configuration: IWindowConfiguration, + private options: IWorkbenchOptions, private serviceCollection: ServiceCollection, @IInstantiationService instantiationService: IInstantiationService, @IWorkspaceContextService contextService: IWorkspaceContextService, @@ -191,9 +195,6 @@ export class Workbench extends Disposable implements IWorkbenchLayoutService { private doStartup(): Promise { - // Logging - this.logService.trace('workbench configuration', JSON.stringify(this.configuration)); - // Configure emitter leak warning threshold setGlobalLeakWarningThreshold(175); @@ -302,13 +303,6 @@ export class Workbench extends Disposable implements IWorkbenchLayoutService { }); } - private hasInitialFilesToOpen(): boolean { - return !!( - (this.configuration.filesToCreate && this.configuration.filesToCreate.length > 0) || - (this.configuration.filesToOpen && this.configuration.filesToOpen.length > 0) || - (this.configuration.filesToDiff && this.configuration.filesToDiff.length > 0)); - } - private registerListeners(accessor: ServicesAccessor): void { const lifecycleService = accessor.get(ILifecycleService); const storageService = accessor.get(IStorageService); @@ -409,7 +403,7 @@ export class Workbench extends Disposable implements IWorkbenchLayoutService { private createEditorPart(): void { const editorContainer = this.createPart(Parts.EDITOR_PART, 'main', 'editor'); - this.parts.get(Parts.EDITOR_PART).create(editorContainer, { restorePreviousState: !this.hasInitialFilesToOpen() }); + this.parts.get(Parts.EDITOR_PART).create(editorContainer, { restorePreviousState: !this.options.hasInitialFilesToOpen }); } private createStatusbarPart(): void { @@ -885,7 +879,7 @@ export class Workbench extends Disposable implements IWorkbenchLayoutService { const backupFileService = accessor.get(IBackupFileService); // Files to open, diff or create - if (this.hasInitialFilesToOpen()) { + if (this.options.hasInitialFilesToOpen) { // Files to diff is exclusive const filesToDiff = this.toInputs(configuration.filesToDiff, false); diff --git a/src/vs/workbench/electron-browser/main.ts b/src/vs/workbench/electron-browser/main.ts index ece9e42d4cf21..99229a99bffe8 100644 --- a/src/vs/workbench/electron-browser/main.ts +++ b/src/vs/workbench/electron-browser/main.ts @@ -7,7 +7,7 @@ import * as fs from 'fs'; import * as gracefulFs from 'graceful-fs'; import { createHash } from 'crypto'; import { importEntries, mark } from 'vs/base/common/performance'; -import { Workbench } from 'vs/workbench/electron-browser/workbench'; +import { Workbench, IWorkbenchOptions } from 'vs/workbench/browser/workbench'; import { ElectronWindow } from 'vs/workbench/electron-browser/window'; import { setZoomLevel, setZoomFactor, setFullscreen } from 'vs/base/browser/browser'; import { domContentLoaded, addDisposableListener, EventType, scheduleAtNextAnimationFrame } from 'vs/base/browser/dom'; @@ -102,6 +102,13 @@ class CodeRendererMain extends Disposable { }); } + private hasInitialFilesToOpen(): boolean { + return !!( + (this.configuration.filesToCreate && this.configuration.filesToCreate.length > 0) || + (this.configuration.filesToOpen && this.configuration.filesToOpen.length > 0) || + (this.configuration.filesToDiff && this.configuration.filesToDiff.length > 0)); + } + open(): Promise { const electronMainClient = this._register(new ElectronIPCClient(`window:${this.configuration.windowId}`)); @@ -116,7 +123,7 @@ class CodeRendererMain extends Disposable { this.workbench = instantiationService.createInstance( Workbench, document.body, - this.configuration, + { hasInitialFilesToOpen: this.hasInitialFilesToOpen() } as IWorkbenchOptions, services ); @@ -142,6 +149,9 @@ class CodeRendererMain extends Disposable { if (this.configuration['export-default-configuration']) { instantiationService.createInstance(DefaultConfigurationExportHelper); } + + // Logging + instantiationService.invokeFunction(accessor => accessor.get(ILogService).trace('workbench configuration', JSON.stringify(this.configuration))); }); }); }