diff --git a/src/vs/workbench/api/node/extHost.contribution.ts b/src/vs/workbench/api/node/extHost.contribution.ts new file mode 100644 index 00000000000..f0faa4b9769 --- /dev/null +++ b/src/vs/workbench/api/node/extHost.contribution.ts @@ -0,0 +1,74 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +'use strict'; + +import {IWorkbenchContribution} from 'vs/workbench/common/contributions'; +import {Registry} from 'vs/platform/platform'; +import {IWorkbenchContributionsRegistry, Extensions as WorkbenchExtensions} from 'vs/workbench/common/contributions'; +import {IInstantiationService} from 'vs/platform/instantiation/common/instantiation'; +import {IThreadService} from 'vs/platform/thread/common/thread'; +import {MainThreadDocuments} from 'vs/workbench/api/node/extHostDocuments'; +import {MainProcessTextMateSyntax} from 'vs/editor/node/textMate/TMSyntax'; +import {MainProcessTextMateSnippet} from 'vs/editor/node/textMate/TMSnippets'; +import {JSONValidationExtensionPoint} from 'vs/platform/jsonschemas/common/jsonValidationExtensionPoint'; +import {LanguageConfigurationFileHandler} from 'vs/editor/node/languageConfiguration'; +import {MainThreadFileSystemEventService} from 'vs/workbench/api/node/extHostFileSystemEventService'; +import {MainThreadQuickOpen} from 'vs/workbench/api/node/extHostQuickOpen'; +import {MainThreadStatusBar} from 'vs/workbench/api/node/extHostStatusBar'; +import {MainThreadCommands} from 'vs/workbench/api/node/extHostCommands'; +import {RemoteTelemetryServiceHelper} from 'vs/platform/telemetry/common/remoteTelemetryService'; +import {MainThreadDiagnostics} from 'vs/workbench/api/node/extHostDiagnostics'; +import {MainThreadOutputService} from 'vs/workbench/api/node/extHostOutputService'; +import {MainThreadMessageService} from 'vs/workbench/api/node/extHostMessageService'; +import {MainThreadLanguages} from 'vs/workbench/api/node/extHostLanguages'; +import {MainThreadEditors} from 'vs/workbench/api/node/extHostEditors'; +import {MainThreadWorkspace} from 'vs/workbench/api/node/extHostWorkspace'; +import {MainThreadConfiguration} from 'vs/workbench/api/node/extHostConfiguration'; +import {MainThreadLanguageFeatures} from 'vs/workbench/api/node/extHostLanguageFeatures'; +import {MainThreadStorage} from 'vs/platform/storage/common/remotable.storage'; +import {MainProcessVSCodeAPIHelper} from 'vs/workbench/api/node/extHost.api.impl'; + +export class ExtHostContribution implements IWorkbenchContribution { + + constructor( + @IThreadService private threadService: IThreadService, + @IInstantiationService private instantiationService: IInstantiationService + ) { + this.initExtensionSystem(); + } + + public getId(): string { + return 'vs.api.extHost'; + } + + private initExtensionSystem(): void { + this.threadService.getRemotable(MainProcessVSCodeAPIHelper); + this.threadService.getRemotable(MainThreadDocuments); + this.threadService.getRemotable(RemoteTelemetryServiceHelper); + this.instantiationService.createInstance(MainProcessTextMateSyntax); + this.instantiationService.createInstance(MainProcessTextMateSnippet); + this.instantiationService.createInstance(JSONValidationExtensionPoint); + this.instantiationService.createInstance(LanguageConfigurationFileHandler); + this.threadService.getRemotable(MainThreadConfiguration); + this.threadService.getRemotable(MainThreadQuickOpen); + this.threadService.getRemotable(MainThreadStatusBar); + this.instantiationService.createInstance(MainThreadFileSystemEventService); + this.threadService.getRemotable(MainThreadCommands); + this.threadService.getRemotable(MainThreadOutputService); + this.threadService.getRemotable(MainThreadDiagnostics); + this.threadService.getRemotable(MainThreadMessageService); + this.threadService.getRemotable(MainThreadLanguages); + this.threadService.getRemotable(MainThreadWorkspace); + this.threadService.getRemotable(MainThreadEditors); + this.threadService.getRemotable(MainThreadStorage); + this.threadService.getRemotable(MainThreadLanguageFeatures); + } +} + +// Register File Tracker +Registry.as(WorkbenchExtensions.Workbench).registerWorkbenchContribution( + ExtHostContribution +); \ No newline at end of file diff --git a/src/vs/workbench/electron-browser/shell.ts b/src/vs/workbench/electron-browser/shell.ts index d0901dfc5dc..c87cc194273 100644 --- a/src/vs/workbench/electron-browser/shell.ts +++ b/src/vs/workbench/electron-browser/shell.ts @@ -44,29 +44,9 @@ import {CodeEditorServiceImpl} from 'vs/editor/browser/services/codeEditorServic import {ICodeEditorService} from 'vs/editor/common/services/codeEditorService'; import {EditorWorkerServiceImpl} from 'vs/editor/common/services/editorWorkerServiceImpl'; import {IEditorWorkerService} from 'vs/editor/common/services/editorWorkerService'; -import {MainProcessVSCodeAPIHelper} from 'vs/workbench/api/node/extHost.api.impl'; import {MainProcessExtensionService} from 'vs/platform/extensions/common/nativeExtensionService'; -import {MainThreadDocuments} from 'vs/workbench/api/node/extHostDocuments'; -import {MainProcessTextMateSyntax} from 'vs/editor/node/textMate/TMSyntax'; -import {MainProcessTextMateSnippet} from 'vs/editor/node/textMate/TMSnippets'; -import {JSONValidationExtensionPoint} from 'vs/platform/jsonschemas/common/jsonValidationExtensionPoint'; -import {LanguageConfigurationFileHandler} from 'vs/editor/node/languageConfiguration'; -import {MainThreadFileSystemEventService} from 'vs/workbench/api/node/extHostFileSystemEventService'; -import {MainThreadQuickOpen} from 'vs/workbench/api/node/extHostQuickOpen'; -import {MainThreadStatusBar} from 'vs/workbench/api/node/extHostStatusBar'; -import {MainThreadCommands} from 'vs/workbench/api/node/extHostCommands'; -import {RemoteTelemetryServiceHelper} from 'vs/platform/telemetry/common/remoteTelemetryService'; -import {MainThreadDiagnostics} from 'vs/workbench/api/node/extHostDiagnostics'; -import {MainThreadOutputService} from 'vs/workbench/api/node/extHostOutputService'; -import {MainThreadMessageService} from 'vs/workbench/api/node/extHostMessageService'; -import {MainThreadLanguages} from 'vs/workbench/api/node/extHostLanguages'; -import {MainThreadEditors} from 'vs/workbench/api/node/extHostEditors'; -import {MainThreadWorkspace} from 'vs/workbench/api/node/extHostWorkspace'; -import {MainThreadConfiguration} from 'vs/workbench/api/node/extHostConfiguration'; -import {MainThreadLanguageFeatures} from 'vs/workbench/api/node/extHostLanguageFeatures'; import {IOptions} from 'vs/workbench/common/options'; import {IStorageService} from 'vs/platform/storage/common/storage'; -import {MainThreadStorage} from 'vs/platform/storage/common/remotable.storage'; import {ServiceCollection} from 'vs/platform/instantiation/common/serviceCollection'; import {InstantiationService} from 'vs/platform/instantiation/common/instantiationService'; import {IContextViewService, IContextMenuService} from 'vs/platform/contextview/browser/contextView'; @@ -192,9 +172,6 @@ export class WorkbenchShell { // Workbench this.workbench = instantiationService.createInstance(Workbench, workbenchContainer.getHTMLElement(), this.workspace, this.configuration, this.options, serviceCollection); this.workbench.startup({ - onServicesCreated: () => { - this.initExtensionSystem(); - }, onWorkbenchStarted: () => { this.onWorkbenchStarted(); } @@ -332,30 +309,6 @@ export class WorkbenchShell { return result; } - // TODO@Alex, TODO@Joh move this out of here? - private initExtensionSystem(): void { - this.threadService.getRemotable(MainProcessVSCodeAPIHelper); - this.threadService.getRemotable(MainThreadDocuments); - this.threadService.getRemotable(RemoteTelemetryServiceHelper); - this.workbench.getInstantiationService().createInstance(MainProcessTextMateSyntax); - this.workbench.getInstantiationService().createInstance(MainProcessTextMateSnippet); - this.workbench.getInstantiationService().createInstance(JSONValidationExtensionPoint); - this.workbench.getInstantiationService().createInstance(LanguageConfigurationFileHandler); - this.threadService.getRemotable(MainThreadConfiguration); - this.threadService.getRemotable(MainThreadQuickOpen); - this.threadService.getRemotable(MainThreadStatusBar); - this.workbench.getInstantiationService().createInstance(MainThreadFileSystemEventService); - this.threadService.getRemotable(MainThreadCommands); - this.threadService.getRemotable(MainThreadOutputService); - this.threadService.getRemotable(MainThreadDiagnostics); - this.threadService.getRemotable(MainThreadMessageService); - this.threadService.getRemotable(MainThreadLanguages); - this.threadService.getRemotable(MainThreadWorkspace); - this.threadService.getRemotable(MainThreadEditors); - this.threadService.getRemotable(MainThreadStorage); - this.threadService.getRemotable(MainThreadLanguageFeatures); - } - public open(): void { // Listen on unexpected errors diff --git a/src/vs/workbench/workbench.main.js b/src/vs/workbench/workbench.main.js index ffa5618f20c..9b4d7778dfd 100644 --- a/src/vs/workbench/workbench.main.js +++ b/src/vs/workbench/workbench.main.js @@ -86,10 +86,11 @@ define([ 'vs/workbench/electron-browser/darwin/cli.contribution', + 'vs/workbench/api/node/extHost.contribution', + 'vs/workbench/electron-browser/main.contribution', 'vs/workbench/electron-browser/main', - 'vs/workbench/parts/themes/test/electron-browser/themes.test.contribution' ], function() {