本文整理汇总了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();
});
});
开发者ID:13572293130,项目名称:vscode,代码行数:28,代码来源:editorModel.test.ts
示例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);
}
开发者ID:13572293130,项目名称:vscode,代码行数:33,代码来源:editorWorkerServer.ts
示例3: initServices
private initServices(): { serviceCollection: ServiceCollection, logService: ILogService } {
const serviceCollection = new ServiceCollection();
const logService = new SimpleLogService();
serviceCollection.set(ILogService, logService);
return { serviceCollection, logService };
}
开发者ID:joelday,项目名称:vscode,代码行数:8,代码来源:nodeless.main.ts
示例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);
});
});
}
开发者ID:GYGit,项目名称:vscode,代码行数:58,代码来源:sharedProcessMain.ts
示例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;
}
开发者ID:AjuanM,项目名称:vscode,代码行数:12,代码来源:servicesTestUtils.ts
示例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;
}
开发者ID:INTELOGIE,项目名称:vscode,代码行数:12,代码来源:servicesTestUtils.ts
示例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);
});
});
}
开发者ID:Magicwalker,项目名称:vscode,代码行数:51,代码来源:sharedProcessMain.ts
示例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);
}
开发者ID:fedor4ever,项目名称:vscode,代码行数:27,代码来源:editorWorkerServer.ts
示例9:
this.createWorkspaceService(payload, environmentService, remoteAgentService, logService).then(service => {
// Workspace
serviceCollection.set(IWorkspaceContextService, service);
// Configuration
serviceCollection.set(IConfigurationService, service);
return service;
}),
开发者ID:joelday,项目名称:vscode,代码行数:10,代码来源:main.ts
注:本文中的vs/platform/instantiation/common/serviceCollection.ServiceCollection类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论