本文整理汇总了TypeScript中vs/platform/instantiation/common/serviceCollection.ServiceCollection类的典型用法代码示例。如果您正苦于以下问题:TypeScript ServiceCollection类的具体用法?TypeScript ServiceCollection怎么用?TypeScript ServiceCollection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ServiceCollection类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: test
test('TextDiffEditorModel', function (done) {
let services = new ServiceCollection();
services.set(IModeService, createMockModeService());
services.set(IModelService, createMockModelService());
let inst = new InstantiationService(services);
let input = inst.createInstance(StringEditorInput, 'name', 'description', 'value', 'text/plain', false);
let otherInput = inst.createInstance(StringEditorInput, 'name2', 'description', 'value2', 'text/plain', false);
let diffInput = new DiffEditorInput('name', 'description', input, otherInput);
diffInput.resolve(true).then(function (model: any) {
assert(model);
assert(model instanceof TextDiffEditorModel);
let diffEditorModel = model.textDiffEditorModel;
assert(diffEditorModel.original);
assert(diffEditorModel.modified);
return diffInput.resolve(true).then(function (model: any) {
assert(model.isResolved());
assert(diffEditorModel !== model.textDiffEditorModel);
diffInput.dispose();
assert(!model.textDiffEditorModel);
});
}).done(() => {
done();
});
});
示例2: initialize
public initialize(mainThread:WorkerServer, complete:ICallback, error:ICallback, progress:ICallback, initData:IInitData):void {
const services = new ServiceCollection();
const extensionService = new WorkerExtensionService();
const contextService = new BaseWorkspaceContextService(initData.contextService.workspace, initData.contextService.configuration, initData.contextService.options);
this.threadService = new WorkerThreadService(mainThread.getRemoteCom());
this.threadService.setInstantiationService(new InstantiationService(new ServiceCollection([IThreadService, this.threadService])));
const telemetryServiceInstance = new RemoteTelemetryService('workerTelemetry', this.threadService);
const resourceService = new ResourceService();
const markerService = new SecondaryMarkerService(this.threadService);
const modeService = new ModeServiceImpl(this.threadService, extensionService);
const requestService = new BaseRequestService(contextService, telemetryServiceInstance);
services.set(IExtensionService, extensionService);
services.set(IThreadService, this.threadService);
services.set(IModeService, modeService);
services.set(IWorkspaceContextService, contextService);
services.set(IEventService, new EventService());
services.set(IResourceService, resourceService);
services.set(IMarkerService, markerService);
services.set(ITelemetryService, telemetryServiceInstance);
services.set(IRequestService, requestService);
const instantiationService = new InstantiationService(services);
this.threadService.setInstantiationService(instantiationService);
// Instantiate thread actors
this.threadService.getRemotable(ModeServiceWorkerHelper);
this.threadService.getRemotable(ModelServiceWorkerHelper);
complete(undefined);
}
示例3: initServices
private initServices(): { serviceCollection: ServiceCollection, logService: ILogService } {
const serviceCollection = new ServiceCollection();
const logService = new SimpleLogService();
serviceCollection.set(ILogService, logService);
return { serviceCollection, logService };
}
示例4: main
function main(server: Server): void {
const services = new ServiceCollection();
services.set(IEventService, new SyncDescriptor(EventService));
services.set(IEnvironmentService, new SyncDescriptor(EnvironmentService, parseArgs(process.argv), process.execPath));
services.set(IConfigurationService, new SyncDescriptor(ConfigurationService));
services.set(IRequestService, new SyncDescriptor(RequestService));
const instantiationService = new InstantiationService(services);
instantiationService.invokeFunction(accessor => {
const appenders: AppInsightsAppender[] = [];
if (product.aiConfig && product.aiConfig.key) {
appenders.push(new AppInsightsAppender(eventPrefix, null, product.aiConfig.key));
}
if (product.aiConfig && product.aiConfig.asimovKey) {
appenders.push(new AppInsightsAppender(eventPrefix, null, product.aiConfig.asimovKey));
}
// It is important to dispose the AI adapter properly because
// only then they flush remaining data.
process.once('exit', () => appenders.forEach(a => a.dispose()));
const appender = combinedAppender(...appenders);
server.registerChannel('telemetryAppender', new TelemetryAppenderChannel(appender));
const services = new ServiceCollection();
const { appRoot, extensionsPath, extensionDevelopmentPath, isBuilt } = accessor.get(IEnvironmentService);
if (isBuilt && !extensionDevelopmentPath && product.enableTelemetry) {
const config: ITelemetryServiceConfig = {
appender,
commonProperties: resolveCommonProperties(product.commit, pkg.version),
piiPaths: [appRoot, extensionsPath]
};
services.set(ITelemetryService, new SyncDescriptor(TelemetryService, config));
} else {
services.set(ITelemetryService, NullTelemetryService);
}
services.set(IExtensionManagementService, new SyncDescriptor(ExtensionManagementService));
services.set(IExtensionGalleryService, new SyncDescriptor(ExtensionGalleryService));
const instantiationService2 = instantiationService.createChild(services);
instantiationService2.invokeFunction(accessor => {
const extensionManagementService = accessor.get(IExtensionManagementService);
const channel = new ExtensionManagementChannel(extensionManagementService);
server.registerChannel('extensions', channel);
// eventually clean up old extensions
setTimeout(() => (extensionManagementService as ExtensionManagementService).removeDeprecatedExtensions(), 100);
});
});
}
示例5: createMockModeService
export function createMockModeService(): IModeService {
let services = new ServiceCollection();
let inst = new InstantiationService(services);
var extensionService = new MockExtensionService();
services.set(IExtensionService, extensionService);
var modeService = new MockModeService(inst, extensionService);
services.set(IModeService, modeService);
return modeService;
}
示例6: createMockModeService
export function createMockModeService(): IModeService {
var threadService = NULL_THREAD_SERVICE;
var extensionService = new MockExtensionService();
var modeService = new MockModeService(threadService, extensionService);
var services = new ServiceCollection();
services.set(IThreadService, threadService);
services.set(IExtensionService, extensionService);
services.set(IModeService, modeService);
var inst = new InstantiationService(services);
threadService.setInstantiationService(inst);
return modeService;
}
示例7: main
function main(server: Server): void {
const services = new ServiceCollection();
services.set(IEventService, new SyncDescriptor(EventService));
services.set(IEnvironmentService, new SyncDescriptor(EnvironmentService));
services.set(IExtensionManagementService, new SyncDescriptor(ExtensionManagementService));
services.set(IConfigurationService, new SyncDescriptor(NodeConfigurationService));
const instantiationService = new InstantiationService(services);
instantiationService.invokeFunction(accessor => {
const appenders: AppInsightsAppender[] = [];
if (product.aiConfig && product.aiConfig.key) {
appenders.push(new AppInsightsAppender(eventPrefix, null, product.aiConfig.key));
}
if (product.aiConfig && product.aiConfig.asimovKey) {
appenders.push(new AppInsightsAppender(eventPrefix, null, product.aiConfig.asimovKey));
}
// It is important to dispose the AI adapter properly because
// only then they flush remaining data.
process.once('exit', () => appenders.forEach(a => a.dispose()));
const appender = combinedAppender(...appenders);
server.registerChannel('telemetryAppender', new TelemetryAppenderChannel(appender));
const { appRoot, extensionsPath } = accessor.get(IEnvironmentService);
const config: ITelemetryServiceConfig = {
appender,
commonProperties: TPromise.as({}),
piiPaths: [appRoot, extensionsPath]
};
const services = new ServiceCollection();
services.set(ITelemetryService, new SyncDescriptor(TelemetryService, config));
const instantiationService2 = instantiationService.createChild(services);
instantiationService2.invokeFunction(accessor => {
// const telemetryService = accessor.get(ITelemetryService);
const extensionManagementService = accessor.get(IExtensionManagementService);
const channel = new ExtensionManagementChannel(extensionManagementService);
server.registerChannel('extensions', channel);
// eventually clean up old extensions
setTimeout(() => (extensionManagementService as ExtensionManagementService).removeDeprecatedExtensions(), 5000);
});
});
}
示例8: initialize
public initialize(mainThread:WorkerServer, complete:ICallback, error:ICallback, progress:ICallback, initData:IInitData):void {
const services = new ServiceCollection();
const instantiationService = new InstantiationService(services);
const extensionService = new WorkerExtensionService();
services.set(IExtensionService, extensionService);
const contextService = new BaseWorkspaceContextService(initData.contextService.workspace, initData.contextService.configuration, initData.contextService.options);
services.set(IWorkspaceContextService, contextService);
const resourceService = new ResourceService();
services.set(IResourceService, resourceService);
const requestService = new BaseRequestService(contextService, NullTelemetryService);
services.set(IRequestService, requestService);
services.set(IEventService, new EventService());
const modeService = new ModeServiceImpl(instantiationService, extensionService);
services.set(IModeService, modeService);
this.compatWorkerService = new CompatWorkerServiceWorker(resourceService, modeService, initData.modesRegistryData);
services.set(ICompatWorkerService, this.compatWorkerService);
complete(undefined);
}
示例9:
this.createWorkspaceService(payload, environmentService, remoteAgentService, logService).then(service => {
// Workspace
serviceCollection.set(IWorkspaceContextService, service);
// Configuration
serviceCollection.set(IConfigurationService, service);
return service;
}),