提交 92b16d8f 编写于 作者: B Benjamin Pasero

debt - polish main.ts

上级 d3b57e3b
......@@ -27,7 +27,7 @@ bootstrapWindow.load([
perf.mark('main/startup');
// @ts-ignore
return require('vs/workbench/electron-browser/main').startup(configuration);
return require('vs/workbench/electron-browser/main').main(configuration);
});
}, {
removeDeveloperKeybindingsAfterLoad: true,
......
......@@ -59,7 +59,7 @@ import { ProgressService2 } from 'vs/workbench/services/progress/browser/progres
import { TextModelResolverService } from 'vs/workbench/services/textmodelResolver/common/textModelResolverService';
import { ITextModelService } from 'vs/editor/common/services/resolverService';
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection';
import { LifecyclePhase, StartupKind, ILifecycleService } from 'vs/platform/lifecycle/common/lifecycle';
import { LifecyclePhase, StartupKind, ILifecycleService, WillShutdownEvent } from 'vs/platform/lifecycle/common/lifecycle';
import { IWindowService, IWindowConfiguration, IPath, MenuBarVisibility, getTitleBarStyle, IWindowsService } from 'vs/platform/windows/common/windows';
import { IStatusbarService } from 'vs/platform/statusbar/common/statusbar';
import { IMenuService, SyncActionDescriptor } from 'vs/platform/actions/common/actions';
......@@ -146,7 +146,7 @@ import { WorkspaceService, DefaultConfigurationExportHelper } from 'vs/workbench
import { JSONEditingService } from 'vs/workbench/services/configuration/node/jsonEditingService';
import { WorkspaceEditingService } from 'vs/workbench/services/workspace/node/workspaceEditingService';
import { IPCClient, getDelayedChannel } from 'vs/base/parts/ipc/node/ipc';
import { LogStorageAction, StorageService } from 'vs/platform/storage/node/storageService';
import { LogStorageAction } from 'vs/platform/storage/node/storageService';
import { HashService } from 'vs/workbench/services/hash/node/hashService';
import { connect as connectNet } from 'vs/base/parts/ipc/node/ipc.net';
import { DialogChannel } from 'vs/platform/dialogs/node/dialogIpc';
......@@ -260,6 +260,12 @@ export class Workbench extends Disposable implements IPartService {
private static readonly closeWhenEmptyConfigurationKey = 'window.closeWhenEmpty';
private static readonly fontAliasingConfigurationKey = 'workbench.fontAliasing';
private readonly _onShutdown = this._register(new Emitter<void>());
get onShutdown(): Event<void> { return this._onShutdown.event; }
private readonly _onWillShutdown = this._register(new Emitter<WillShutdownEvent>());
get onWillShutdown(): Event<WillShutdownEvent> { return this._onWillShutdown.event; }
_serviceBrand: any;
private previousErrorValue: string;
......@@ -336,7 +342,7 @@ export class Workbench extends Disposable implements IPartService {
private mainProcessClient: IPCClient,
@IInstantiationService private readonly instantiationService: IInstantiationService,
@IWorkspaceContextService private readonly contextService: IWorkspaceContextService,
@IStorageService private readonly storageService: StorageService,
@IStorageService private readonly storageService: IStorageService,
@IConfigurationService private readonly configurationService: WorkspaceService,
@IEnvironmentService private readonly environmentService: IEnvironmentService,
@ILogService private readonly logService: ILogService,
......@@ -351,10 +357,6 @@ export class Workbench extends Disposable implements IPartService {
(configuration.filesToOpen && configuration.filesToOpen.length > 0) ||
(configuration.filesToDiff && configuration.filesToDiff.length > 0);
// TODO@Ben debt
this._register(mainProcessClient);
this._register(logService);
this.registerErrorHandler();
}
......@@ -410,6 +412,9 @@ export class Workbench extends Disposable implements IPartService {
private doStartup(): Promise<void> {
this.workbenchStarted = true;
// Logging
this.logService.trace('workbench configuration', JSON.stringify(this.configuration));
// ARIA
setARIAContainer(document.body);
......@@ -554,8 +559,11 @@ export class Workbench extends Disposable implements IPartService {
serviceCollection.set(ILifecycleService, this.lifecycleService);
this._register(this.lifecycleService.onWillShutdown(event => event.join(this.storageService.close())));
this._register(this.lifecycleService.onShutdown(() => this.dispose()));
this._register(this.lifecycleService.onWillShutdown(event => this._onWillShutdown.fire(event)));
this._register(this.lifecycleService.onShutdown(() => {
this._onShutdown.fire();
this.dispose();
}));
// Request Service
serviceCollection.set(IRequestService, new SyncDescriptor(RequestService, undefined, true));
......@@ -779,7 +787,7 @@ export class Workbench extends Disposable implements IPartService {
this.instantiationService.createInstance(DefaultConfigurationExportHelper);
this.configurationService.acquireInstantiationService(this.getInstantiationService());
this.configurationService.acquireInstantiationService(this.instantiationService);
}
//#region event handling
......@@ -1547,10 +1555,6 @@ export class Workbench extends Disposable implements IPartService {
registerNotificationCommands(this.notificationsCenter, this.notificationsToasts);
}
getInstantiationService(): IInstantiationService {
return this.instantiationService;
}
private saveState(e: IWillSaveStateEvent): void {
if (this.zenMode.active) {
this.storageService.store(Workbench.zenModeActiveStorageKey, true, StorageScope.WORKSPACE);
......
......@@ -9,7 +9,7 @@ import 'vs/editor/editor.all';
import 'vs/workbench/api/electron-browser/extensionHost.contribution';
import 'vs/workbench/electron-browser/shell.contribution';
import 'vs/workbench/electron-browser/main.contribution';
import 'vs/workbench/browser/workbench.contribution';
import 'vs/workbench/electron-browser/main';
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册