本文整理汇总了TypeScript中vs/workbench/services/files2/common/fileService2.FileService2.registerProvider方法的典型用法代码示例。如果您正苦于以下问题:TypeScript FileService2.registerProvider方法的具体用法?TypeScript FileService2.registerProvider怎么用?TypeScript FileService2.registerProvider使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vs/workbench/services/files2/common/fileService2.FileService2
的用法示例。
在下文中一共展示了FileService2.registerProvider方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: setup
setup(async () => {
service = new FileService2(new NullLogService());
disposables.push(service);
fileProvider = new TestDiskFileSystemProvider();
service.registerProvider(Schemas.file, fileProvider);
testProvider = new TestDiskFileSystemProvider();
service.registerProvider(testSchema, testProvider);
const id = generateUuid();
testDir = join(parentDir, id);
const sourceDir = getPathFromAmdModule(require, './fixtures/service');
await copy(sourceDir, testDir);
});
示例2: initServices
private initServices(): Promise<{ serviceCollection: ServiceCollection, logService: ILogService, storageService: StorageService }> {
const serviceCollection = new ServiceCollection();
// Main Process
const mainProcessService = this._register(new MainProcessService(this.configuration.windowId));
serviceCollection.set(IMainProcessService, mainProcessService);
// Window
serviceCollection.set(IWindowService, new SyncDescriptor(WindowService, [this.configuration]));
// Environment
const environmentService = new EnvironmentService(this.configuration, this.configuration.execPath);
serviceCollection.set(IEnvironmentService, environmentService);
// Log
const logService = this._register(this.createLogService(mainProcessService, environmentService));
serviceCollection.set(ILogService, logService);
// Files
const fileService = new FileService2(logService);
serviceCollection.set(IFileService, fileService);
fileService.registerProvider(Schemas.file, new DiskFileSystemProvider());
// Remote
const remoteAuthorityResolverService = new RemoteAuthorityResolverService();
serviceCollection.set(IRemoteAuthorityResolverService, remoteAuthorityResolverService);
const remoteAgentService = new RemoteAgentService(this.configuration, environmentService, remoteAuthorityResolverService);
serviceCollection.set(IRemoteAgentService, remoteAgentService);
const connection = remoteAgentService.getConnection();
if (connection) {
const channel = connection.getChannel<IChannel>(REMOTE_FILE_SYSTEM_CHANNEL_NAME);
const fileSystemProvider = new RemoteExtensionsFileSystemProvider(channel);
fileService.registerProvider('vscode-remote', fileSystemProvider);
remoteAgentService.getEnvironment().then(remoteAgentEnvironment => {
const isCaseSensitive = !!(remoteAgentEnvironment && remoteAgentEnvironment.os === OperatingSystem.Linux);
fileSystemProvider.setCaseSensitive(isCaseSensitive);
});
}
return this.resolveWorkspaceInitializationPayload(environmentService).then(payload => Promise.all([
this.createWorkspaceService(payload, environmentService, remoteAgentService, logService).then(service => {
// Workspace
serviceCollection.set(IWorkspaceContextService, service);
// Configuration
serviceCollection.set(IConfigurationService, service);
return service;
}),
this.createStorageService(payload, environmentService, logService, mainProcessService).then(service => {
// Storage
serviceCollection.set(IStorageService, service);
return service;
})
]).then(services => ({ serviceCollection, logService, storageService: services[1] })));
}
示例3: Promise
e.join(new Promise(resolve => {
registrationDisposable = service.registerProvider('test', new NullFileSystemProvider());
resolve();
}));