Skip to content

Commit

Permalink
RPC Protocol ClientProxyHandler Init Events #13172
Browse files Browse the repository at this point in the history
* revert previous approach
  • Loading branch information
jfaltermeier committed Jan 9, 2024
1 parent 966d462 commit 17a810e
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 96 deletions.
26 changes: 9 additions & 17 deletions packages/plugin-ext/src/common/proxy-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ export interface RpcHandlerOptions {
}
export interface ProxyHandlerOptions extends RpcHandlerOptions {
channelProvider: () => Promise<Channel>,
onInitialize?: () => void,
}

export interface InvocationHandlerOptions extends RpcHandlerOptions {
Expand All @@ -38,32 +37,25 @@ export interface InvocationHandlerOptions extends RpcHandlerOptions {
export class ClientProxyHandler<T extends object> implements ProxyHandler<T> {
private rpcDeferred: Deferred<RpcProtocol> = new Deferred();
private isRpcInitialized = false;
private isInitializing = false;

readonly id: string;
private readonly channelProvider: () => Promise<Channel>;
private readonly onInitialize?: () => void;
private readonly encoder: RpcMessageEncoder;
private readonly decoder: RpcMessageDecoder;

constructor(options: ProxyHandlerOptions) {
Object.assign(this, options);
}

initializeRpc(): void {
if (!this.isRpcInitialized && !this.isInitializing) {
this.isInitializing = true;
const clientOptions: RpcProtocolOptions = { encoder: this.encoder, decoder: this.decoder, mode: 'clientOnly' };
this.channelProvider().then(channel => {
const rpc = new RpcProtocol(channel, undefined, clientOptions);
this.isRpcInitialized = true;
if (this.onInitialize) {
this.onInitialize();
}
this.rpcDeferred.resolve(rpc);
this.isInitializing = false;
});
}
private initializeRpc(): void {
// we need to set the flag to true before waiting for the channel provider. Otherwise `get` might
// get called again and we'll try to open a channel more than once
this.isRpcInitialized = true;
const clientOptions: RpcProtocolOptions = { encoder: this.encoder, decoder: this.decoder, mode: 'clientOnly' };
this.channelProvider().then(channel => {
const rpc = new RpcProtocol(channel, undefined, clientOptions);
this.rpcDeferred.resolve(rpc);
});
}

get(target: any, name: string, receiver: any): any {
Expand Down
40 changes: 3 additions & 37 deletions packages/plugin-ext/src/common/rpc-protocol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export interface RPCProtocol extends Disposable {
/**
* Register manually created instance.
*/
set<T, R extends T>(identifier: ProxyIdentifier<T>, instance: R, remoteDependencies?: Set<ProxyIdentifier<T>>): R;
set<T, R extends T>(identifier: ProxyIdentifier<T>, instance: R): R;

}

Expand Down Expand Up @@ -80,8 +80,6 @@ export namespace ConnectionClosedError {
export class RPCProtocolImpl implements RPCProtocol {
private readonly locals = new Map<string, RpcInvocationHandler>();
private readonly proxies = new Map<string, any>();
private readonly handler = new Map<string, any>();
private readonly remoteDependencies = new Map<string, Set<ProxyIdentifier<any>>>();
private readonly multiplexer: ChannelMultiplexer;
private readonly encoder = new MsgPackMessageEncoder();
private readonly decoder = new MsgPackMessageDecoder();
Expand All @@ -93,8 +91,6 @@ export class RPCProtocolImpl implements RPCProtocol {
constructor(channel: Channel) {
this.toDispose.push(this.multiplexer = new ChannelMultiplexer(new BatchingChannel(channel)));
this.toDispose.push(Disposable.create(() => this.proxies.clear()));
this.toDispose.push(Disposable.create(() => this.handler.clear()));
this.toDispose.push(Disposable.create(() => this.remoteDependencies.clear()));
}

dispose(): void {
Expand All @@ -118,23 +114,11 @@ export class RPCProtocolImpl implements RPCProtocol {
}

protected createProxy<T>(proxyId: string): T {
const handler = new ClientProxyHandler({
id: proxyId, encoder: this.encoder, decoder: this.decoder,
channelProvider: () => this.multiplexer.open(proxyId),
onInitialize: () => {
const dependencies = this.remoteDependencies.get(proxyId);
if (dependencies) {
dependencies.forEach(dep => {
this.initialize(dep);
});
}
},
});
this.handler.set(proxyId, handler);
const handler = new ClientProxyHandler({ id: proxyId, encoder: this.encoder, decoder: this.decoder, channelProvider: () => this.multiplexer.open(proxyId) });
return new Proxy(Object.create(null), handler);
}

set<T, R extends T>(identifier: ProxyIdentifier<T>, instance: R, remoteDependencies: Set<ProxyIdentifier<T>> = new Set()): R {
set<T, R extends T>(identifier: ProxyIdentifier<T>, instance: R): R {
if (this.isDisposed) {
throw ConnectionClosedError.create();
}
Expand All @@ -158,29 +142,11 @@ export class RPCProtocolImpl implements RPCProtocol {
if (Disposable.is(instance)) {
this.toDispose.push(instance);
}

this.toDispose.push(Disposable.create(() => this.locals.delete(identifier.id)));

for (const remoteDep of remoteDependencies) {
const deps = new Set(remoteDependencies);
deps.delete(remoteDep);
if (!this.remoteDependencies.has(remoteDep.id)) {
this.remoteDependencies.set(remoteDep.id, new Set());
}
deps.forEach(dep => this.remoteDependencies.get(remoteDep.id)?.add(dep));
}

}
return instance;
}

protected initialize<T>(proxyId: ProxyIdentifier<T>): void {
/* make sure proxy exists */
this.getProxy(proxyId);
/* init */
const handler = this.handler.get(proxyId.id);
handler.initializeRpc();
}
}

/**
Expand Down
12 changes: 5 additions & 7 deletions packages/plugin-ext/src/hosted/browser/worker/worker-main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import 'reflect-metadata';
import { BasicChannel } from '@theia/core/lib/common/message-rpc/channel';
import { Uint8ArrayReadBuffer, Uint8ArrayWriteBuffer } from '@theia/core/lib/common/message-rpc/uint8-array-message-buffer';
import * as theia from '@theia/plugin';
import { emptyPlugin, MAIN_RPC_CONTEXT, Plugin, TerminalServiceExt, PLUGIN_RPC_CONTEXT } from '../../../common/plugin-api-rpc';
import { emptyPlugin, MAIN_RPC_CONTEXT, Plugin, TerminalServiceExt } from '../../../common/plugin-api-rpc';
import { ExtPluginApi } from '../../../common/plugin-ext-api-contribution';
import { getPluginId, PluginMetadata } from '../../../common/plugin-protocol';
import { RPCProtocolImpl } from '../../../common/rpc-protocol';
Expand Down Expand Up @@ -208,14 +208,12 @@ const handler = {
};
ctx['theia'] = new Proxy(Object.create(null), handler);

rpc.set(MAIN_RPC_CONTEXT.HOSTED_PLUGIN_MANAGER_EXT, pluginManager,
new Set([PLUGIN_RPC_CONTEXT.PREFERENCE_REGISTRY_MAIN, PLUGIN_RPC_CONTEXT.MESSAGE_REGISTRY_MAIN, PLUGIN_RPC_CONTEXT.NOTIFICATION_MAIN, PLUGIN_RPC_CONTEXT.STORAGE_MAIN,
PLUGIN_RPC_CONTEXT.WEBVIEWS_MAIN]));
rpc.set(MAIN_RPC_CONTEXT.HOSTED_PLUGIN_MANAGER_EXT, pluginManager);
rpc.set(MAIN_RPC_CONTEXT.EDITORS_AND_DOCUMENTS_EXT, editorsAndDocuments);
rpc.set(MAIN_RPC_CONTEXT.WORKSPACE_EXT, workspaceExt, new Set([PLUGIN_RPC_CONTEXT.WORKSPACE_MAIN, PLUGIN_RPC_CONTEXT.DOCUMENTS_MAIN, PLUGIN_RPC_CONTEXT.TEXT_EDITORS_MAIN]));
rpc.set(MAIN_RPC_CONTEXT.PREFERENCE_REGISTRY_EXT, preferenceRegistryExt, new Set([PLUGIN_RPC_CONTEXT.PREFERENCE_REGISTRY_MAIN, PLUGIN_RPC_CONTEXT.WORKSPACE_MAIN]));
rpc.set(MAIN_RPC_CONTEXT.WORKSPACE_EXT, workspaceExt);
rpc.set(MAIN_RPC_CONTEXT.PREFERENCE_REGISTRY_EXT, preferenceRegistryExt);
rpc.set(MAIN_RPC_CONTEXT.STORAGE_EXT, storageProxy);
rpc.set(MAIN_RPC_CONTEXT.WEBVIEWS_EXT, webviewExt, new Set([PLUGIN_RPC_CONTEXT.WEBVIEWS_MAIN, PLUGIN_RPC_CONTEXT.WORKSPACE_MAIN]));
rpc.set(MAIN_RPC_CONTEXT.WEBVIEWS_EXT, webviewExt);

function isElectron(): boolean {
if (typeof navigator === 'object' && typeof navigator.userAgent === 'string' && navigator.userAgent.indexOf('Electron') >= 0) {
Expand Down
15 changes: 7 additions & 8 deletions packages/plugin-ext/src/main/browser/main-context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export function setUpPluginApi(rpc: RPCProtocol, container: interfaces.Container
const untitledResourceResolver = container.get(UntitledResourceResolver);
const languageService = container.get(MonacoLanguages);
const documentsMain = new DocumentsMainImpl(editorsAndDocuments, modelService, rpc, editorManager, openerService, shell, untitledResourceResolver, languageService);
rpc.set(PLUGIN_RPC_CONTEXT.DOCUMENTS_MAIN, documentsMain, new Set([MAIN_RPC_CONTEXT.DOCUMENTS_EXT, MAIN_RPC_CONTEXT.EDITORS_AND_DOCUMENTS_EXT]));
rpc.set(PLUGIN_RPC_CONTEXT.DOCUMENTS_MAIN, documentsMain);

const notebookService = container.get(NotebookService);
const pluginSupport = container.get(HostedPluginSupport);
Expand All @@ -111,14 +111,13 @@ export function setUpPluginApi(rpc: RPCProtocol, container: interfaces.Container
rpc.set(PLUGIN_RPC_CONTEXT.NOTEBOOK_EDITORS_MAIN, notebookEditorsMain);
const notebookDocumentsMain = new NotebookDocumentsMainImpl(rpc, container);
rpc.set(PLUGIN_RPC_CONTEXT.NOTEBOOK_DOCUMENTS_MAIN, notebookDocumentsMain);
rpc.set(PLUGIN_RPC_CONTEXT.NOTEBOOK_DOCUMENTS_AND_EDITORS_MAIN, new NotebooksAndEditorsMain(rpc, container, notebookDocumentsMain, notebookEditorsMain),
new Set([MAIN_RPC_CONTEXT.NOTEBOOKS_EXT, MAIN_RPC_CONTEXT.NOTEBOOK_EDITORS_EXT, MAIN_RPC_CONTEXT.NOTEBOOK_DOCUMENTS_EXT]));
rpc.set(PLUGIN_RPC_CONTEXT.NOTEBOOK_DOCUMENTS_AND_EDITORS_MAIN, new NotebooksAndEditorsMain(rpc, container, notebookDocumentsMain, notebookEditorsMain));
rpc.set(PLUGIN_RPC_CONTEXT.NOTEBOOK_KERNELS_MAIN, new NotebookKernelsMainImpl(rpc, container));

const bulkEditService = container.get(MonacoBulkEditService);
const monacoEditorService = container.get(MonacoEditorService);
const editorsMain = new TextEditorsMainImpl(editorsAndDocuments, documentsMain, rpc, bulkEditService, monacoEditorService);
rpc.set(PLUGIN_RPC_CONTEXT.TEXT_EDITORS_MAIN, editorsMain, new Set([MAIN_RPC_CONTEXT.TEXT_EDITORS_EXT, MAIN_RPC_CONTEXT.DOCUMENTS_EXT]));
rpc.set(PLUGIN_RPC_CONTEXT.TEXT_EDITORS_MAIN, editorsMain);

// start listening only after all clients are subscribed to events
editorsAndDocuments.listen();
Expand All @@ -133,7 +132,7 @@ export function setUpPluginApi(rpc: RPCProtocol, container: interfaces.Container
rpc.set(PLUGIN_RPC_CONTEXT.NOTIFICATION_MAIN, notificationMain);

const testingMain = new TestingMainImpl(rpc, container, commandRegistryMain);
rpc.set(PLUGIN_RPC_CONTEXT.TESTING_MAIN, testingMain, new Set([MAIN_RPC_CONTEXT.TESTING_EXT, MAIN_RPC_CONTEXT.COMMAND_REGISTRY_EXT]));
rpc.set(PLUGIN_RPC_CONTEXT.TESTING_MAIN, testingMain);

const terminalMain = new TerminalServiceMainImpl(rpc, container);
rpc.set(PLUGIN_RPC_CONTEXT.TERMINAL_MAIN, terminalMain);
Expand All @@ -153,10 +152,10 @@ export function setUpPluginApi(rpc: RPCProtocol, container: interfaces.Container
rpc.set(PLUGIN_RPC_CONTEXT.WEBVIEWS_MAIN, webviewsMain);

const customEditorsMain = new CustomEditorsMainImpl(rpc, container, webviewsMain);
rpc.set(PLUGIN_RPC_CONTEXT.CUSTOM_EDITORS_MAIN, customEditorsMain, new Set([MAIN_RPC_CONTEXT.CUSTOM_EDITORS_EXT, MAIN_RPC_CONTEXT.WEBVIEWS_EXT]));
rpc.set(PLUGIN_RPC_CONTEXT.CUSTOM_EDITORS_MAIN, customEditorsMain);

const webviewViewsMain = new WebviewViewsMainImpl(rpc, container, webviewsMain);
rpc.set(PLUGIN_RPC_CONTEXT.WEBVIEW_VIEWS_MAIN, webviewViewsMain, new Set([MAIN_RPC_CONTEXT.WEBVIEW_VIEWS_EXT, MAIN_RPC_CONTEXT.WEBVIEWS_EXT]));
rpc.set(PLUGIN_RPC_CONTEXT.WEBVIEW_VIEWS_MAIN, webviewViewsMain);

const storageMain = new StorageMainImpl(container);
rpc.set(PLUGIN_RPC_CONTEXT.STORAGE_MAIN, storageMain);
Expand All @@ -168,7 +167,7 @@ export function setUpPluginApi(rpc: RPCProtocol, container: interfaces.Container
rpc.set(PLUGIN_RPC_CONTEXT.TASKS_MAIN, tasksMain);

const debugMain = new DebugMainImpl(rpc, connectionMain, container);
rpc.set(PLUGIN_RPC_CONTEXT.DEBUG_MAIN, debugMain, new Set([MAIN_RPC_CONTEXT.DEBUG_EXT, MAIN_RPC_CONTEXT.CONNECTION_EXT]));
rpc.set(PLUGIN_RPC_CONTEXT.DEBUG_MAIN, debugMain);

const fs = new FileSystemMainImpl(rpc, container);
const fsEventService = new MainFileSystemEventService(rpc, container);
Expand Down
6 changes: 2 additions & 4 deletions packages/plugin-ext/src/plugin/documents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,7 @@ export class DocumentsExtImpl implements DocumentsExt {
const uriString = uri.toString();
const data = this.editorsAndDocuments.getDocument(uriString);
if (!data) {
console.error('unknown document: ' + uriString);
return;
throw new Error('unknown document: ' + uriString);
}
data.acceptIsDirty(isDirty);
this._onDidChangeDocument.fire({
Expand All @@ -173,8 +172,7 @@ export class DocumentsExtImpl implements DocumentsExt {
const uriString = uri.toString();
const data = this.editorsAndDocuments.getDocument(uriString);
if (!data) {
console.error('unknown document: ' + uriString);
return;
throw new Error('unknown document: ' + uriString);
}
data.acceptIsDirty(isDirty);
data.onEvents(e);
Expand Down
34 changes: 11 additions & 23 deletions packages/plugin-ext/src/plugin/plugin-context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -272,43 +272,31 @@ export function createAPIFactory(
const notificationExt = rpc.set(MAIN_RPC_CONTEXT.NOTIFICATION_EXT, new NotificationExtImpl(rpc));
const editors = rpc.set(MAIN_RPC_CONTEXT.TEXT_EDITORS_EXT, new TextEditorsExtImpl(rpc, editorsAndDocumentsExt));
const documents = rpc.set(MAIN_RPC_CONTEXT.DOCUMENTS_EXT, new DocumentsExtImpl(rpc, editorsAndDocumentsExt));
const notebooksExt = rpc.set(MAIN_RPC_CONTEXT.NOTEBOOKS_EXT, new NotebooksExtImpl(rpc, commandRegistry, editorsAndDocumentsExt, documents),
new Set([PLUGIN_RPC_CONTEXT.NOTEBOOKS_MAIN, PLUGIN_RPC_CONTEXT.NOTEBOOK_DOCUMENTS_MAIN, PLUGIN_RPC_CONTEXT.NOTEBOOK_EDITORS_MAIN,
PLUGIN_RPC_CONTEXT.COMMAND_REGISTRY_MAIN, PLUGIN_RPC_CONTEXT.DOCUMENTS_MAIN]));
const notebooksExt = rpc.set(MAIN_RPC_CONTEXT.NOTEBOOKS_EXT, new NotebooksExtImpl(rpc, commandRegistry, editorsAndDocumentsExt, documents));
const notebookEditors = rpc.set(MAIN_RPC_CONTEXT.NOTEBOOK_EDITORS_EXT, new NotebookEditorsExtImpl(notebooksExt));
const notebookRenderers = rpc.set(MAIN_RPC_CONTEXT.NOTEBOOK_RENDERERS_EXT, new NotebookRenderersExtImpl(rpc, notebooksExt),
new Set([PLUGIN_RPC_CONTEXT.NOTEBOOK_RENDERERS_MAIN, PLUGIN_RPC_CONTEXT.NOTEBOOKS_MAIN, PLUGIN_RPC_CONTEXT.NOTEBOOK_DOCUMENTS_MAIN,
PLUGIN_RPC_CONTEXT.NOTEBOOK_EDITORS_MAIN]));
const notebookKernels = rpc.set(MAIN_RPC_CONTEXT.NOTEBOOK_KERNELS_EXT, new NotebookKernelsExtImpl(rpc, notebooksExt, commandRegistry),
new Set([PLUGIN_RPC_CONTEXT.NOTEBOOK_KERNELS_MAIN, PLUGIN_RPC_CONTEXT.COMMAND_REGISTRY_MAIN, PLUGIN_RPC_CONTEXT.NOTEBOOKS_MAIN, PLUGIN_RPC_CONTEXT.NOTEBOOK_DOCUMENTS_MAIN,
PLUGIN_RPC_CONTEXT.NOTEBOOK_EDITORS_MAIN]));
const notebookRenderers = rpc.set(MAIN_RPC_CONTEXT.NOTEBOOK_RENDERERS_EXT, new NotebookRenderersExtImpl(rpc, notebooksExt));
const notebookKernels = rpc.set(MAIN_RPC_CONTEXT.NOTEBOOK_KERNELS_EXT, new NotebookKernelsExtImpl(rpc, notebooksExt, commandRegistry));
const notebookDocuments = rpc.set(MAIN_RPC_CONTEXT.NOTEBOOK_DOCUMENTS_EXT, new NotebookDocumentsExtImpl(notebooksExt));
const statusBarMessageRegistryExt = new StatusBarMessageRegistryExt(rpc);
const terminalExt = rpc.set(MAIN_RPC_CONTEXT.TERMINAL_EXT, new TerminalServiceExtImpl(rpc));
const outputChannelRegistryExt = rpc.set(MAIN_RPC_CONTEXT.OUTPUT_CHANNEL_REGISTRY_EXT, new OutputChannelRegistryExtImpl(rpc));
const treeViewsExt = rpc.set(MAIN_RPC_CONTEXT.TREE_VIEWS_EXT, new TreeViewsExtImpl(rpc, commandRegistry),
new Set([PLUGIN_RPC_CONTEXT.TREE_VIEWS_MAIN, PLUGIN_RPC_CONTEXT.COMMAND_REGISTRY_MAIN]));
const tasksExt = rpc.set(MAIN_RPC_CONTEXT.TASKS_EXT, new TasksExtImpl(rpc, terminalExt), new Set([PLUGIN_RPC_CONTEXT.TASKS_MAIN, PLUGIN_RPC_CONTEXT.TERMINAL_MAIN]));
const treeViewsExt = rpc.set(MAIN_RPC_CONTEXT.TREE_VIEWS_EXT, new TreeViewsExtImpl(rpc, commandRegistry));
const tasksExt = rpc.set(MAIN_RPC_CONTEXT.TASKS_EXT, new TasksExtImpl(rpc, terminalExt));
const connectionExt = rpc.set(MAIN_RPC_CONTEXT.CONNECTION_EXT, new ConnectionImpl(rpc.getProxy(PLUGIN_RPC_CONTEXT.CONNECTION_MAIN)));
const fileSystemExt = rpc.set(MAIN_RPC_CONTEXT.FILE_SYSTEM_EXT, new FileSystemExtImpl(rpc));
const languagesExt = rpc.set(MAIN_RPC_CONTEXT.LANGUAGES_EXT, new LanguagesExtImpl(rpc, documents, commandRegistry, fileSystemExt),
new Set([PLUGIN_RPC_CONTEXT.LANGUAGES_MAIN, PLUGIN_RPC_CONTEXT.COMMAND_REGISTRY_MAIN, PLUGIN_RPC_CONTEXT.DOCUMENTS_MAIN, PLUGIN_RPC_CONTEXT.FILE_SYSTEM_MAIN]));
const languagesExt = rpc.set(MAIN_RPC_CONTEXT.LANGUAGES_EXT, new LanguagesExtImpl(rpc, documents, commandRegistry, fileSystemExt));
const extHostFileSystemEvent = rpc.set(MAIN_RPC_CONTEXT.ExtHostFileSystemEventService, new ExtHostFileSystemEventService(rpc, editorsAndDocumentsExt));
const scmExt = rpc.set(MAIN_RPC_CONTEXT.SCM_EXT, new ScmExtImpl(rpc, commandRegistry), new Set([PLUGIN_RPC_CONTEXT.SCM_MAIN, PLUGIN_RPC_CONTEXT.COMMAND_REGISTRY_MAIN]));
const scmExt = rpc.set(MAIN_RPC_CONTEXT.SCM_EXT, new ScmExtImpl(rpc, commandRegistry));
const decorationsExt = rpc.set(MAIN_RPC_CONTEXT.DECORATIONS_EXT, new DecorationsExtImpl(rpc));
const labelServiceExt = rpc.set(MAIN_RPC_CONTEXT.LABEL_SERVICE_EXT, new LabelServiceExtImpl(rpc));
const timelineExt = rpc.set(MAIN_RPC_CONTEXT.TIMELINE_EXT, new TimelineExtImpl(rpc, commandRegistry),
new Set([PLUGIN_RPC_CONTEXT.TIMELINE_MAIN, PLUGIN_RPC_CONTEXT.COMMAND_REGISTRY_MAIN]));
const timelineExt = rpc.set(MAIN_RPC_CONTEXT.TIMELINE_EXT, new TimelineExtImpl(rpc, commandRegistry));
const themingExt = rpc.set(MAIN_RPC_CONTEXT.THEMING_EXT, new ThemingExtImpl(rpc));
const commentsExt = rpc.set(MAIN_RPC_CONTEXT.COMMENTS_EXT, new CommentsExtImpl(rpc, commandRegistry, documents),
new Set([PLUGIN_RPC_CONTEXT.COMMENTS_MAIN, PLUGIN_RPC_CONTEXT.COMMAND_REGISTRY_MAIN, PLUGIN_RPC_CONTEXT.DOCUMENTS_MAIN]));
const commentsExt = rpc.set(MAIN_RPC_CONTEXT.COMMENTS_EXT, new CommentsExtImpl(rpc, commandRegistry, documents));
const tabsExt = rpc.set(MAIN_RPC_CONTEXT.TABS_EXT, new TabsExtImpl(rpc));
const customEditorExt = rpc.set(MAIN_RPC_CONTEXT.CUSTOM_EDITORS_EXT, new CustomEditorsExtImpl(rpc, documents, webviewExt, workspaceExt),
new Set([PLUGIN_RPC_CONTEXT.CUSTOM_EDITORS_MAIN, PLUGIN_RPC_CONTEXT.DOCUMENTS_MAIN]));
const customEditorExt = rpc.set(MAIN_RPC_CONTEXT.CUSTOM_EDITORS_EXT, new CustomEditorsExtImpl(rpc, documents, webviewExt, workspaceExt));
const webviewViewsExt = rpc.set(MAIN_RPC_CONTEXT.WEBVIEW_VIEWS_EXT, new WebviewViewsExtImpl(rpc, webviewExt));
const telemetryExt = rpc.set(MAIN_RPC_CONTEXT.TELEMETRY_EXT, new TelemetryExtImpl());
const testingExt = rpc.set(MAIN_RPC_CONTEXT.TESTING_EXT, new TestingExtImpl(rpc, commandRegistry),
new Set([PLUGIN_RPC_CONTEXT.TESTING_MAIN, PLUGIN_RPC_CONTEXT.COMMAND_REGISTRY_MAIN]));
const testingExt = rpc.set(MAIN_RPC_CONTEXT.TESTING_EXT, new TestingExtImpl(rpc, commandRegistry));
rpc.set(MAIN_RPC_CONTEXT.DEBUG_EXT, debugExt);

return function (plugin: InternalPlugin): typeof theia {
Expand Down

0 comments on commit 17a810e

Please sign in to comment.