Initialize extension host customers only after a connection has been established with the extension host; retire IThreadService

This commit is contained in:
Alex Dima
2017-08-16 18:08:01 +02:00
parent 4489519660
commit 4339a247ab
10 changed files with 74 additions and 109 deletions

View File

@@ -8,10 +8,6 @@
import { IWorkbenchContribution, IWorkbenchContributionsRegistry, Extensions as WorkbenchExtensions } from 'vs/workbench/common/contributions';
import { Registry } from 'vs/platform/registry/common/platform';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { IThreadService, ProxyIdentifier } from 'vs/workbench/services/thread/common/threadService';
import { MainContext, IExtHostContext } from '../node/extHost.protocol';
import { IExtensionService } from 'vs/platform/extensions/common/extensions';
import { ExtHostCustomersRegistry } from "vs/workbench/api/electron-browser/extHostCustomers";
// --- other interested parties
import { JSONValidationExtensionPoint } from 'vs/platform/jsonschemas/common/jsonValidationExtensionPoint';
@@ -49,41 +45,6 @@ import './mainThreadTerminalService';
import './mainThreadTreeViews';
import './mainThreadWorkspace';
export class ExtHostContribution implements IWorkbenchContribution {
constructor(
@IThreadService threadService: IThreadService,
@IInstantiationService instantiationService: IInstantiationService,
@IExtensionService extensionService: IExtensionService
) {
const extHostContext: IExtHostContext = threadService;
// Named customers
const namedCustomers = ExtHostCustomersRegistry.getNamedCustomers();
for (let i = 0, len = namedCustomers.length; i < len; i++) {
const [id, ctor] = namedCustomers[i];
threadService.set(id, instantiationService.createInstance(ctor, extHostContext));
}
// Customers
const customers = ExtHostCustomersRegistry.getCustomers();
for (let i = 0, len = customers.length; i < len; i++) {
const ctor = customers[i];
instantiationService.createInstance(ctor, extHostContext);
}
// Check that no named customers are missing
const expected: ProxyIdentifier<any>[] = Object.keys(MainContext).map((key) => MainContext[key]);
threadService.assertRegistered(expected);
}
public getId(): string {
return 'vs.api.extHost';
}
}
export class ExtensionPoints implements IWorkbenchContribution {
constructor(
@@ -100,9 +61,6 @@ export class ExtensionPoints implements IWorkbenchContribution {
}
}
Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench).registerWorkbenchContribution(
ExtHostContribution
);
Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench).registerWorkbenchContribution(
ExtensionPoints
);
);