import { Channel, Disposable, ReadBuffer, WriteBuffer } from '@theia/core'; import { Emitter, Event } from '@theia/core/lib/common/event'; import { MessageProvider } from '@theia/core/lib/common/message-rpc/channel'; export interface MessageConnection { send(msg: string): void; onMessage: Event; } export declare const RPCProtocol: unique symbol; export interface RPCProtocol extends Disposable { /** * Returns a proxy to an object addressable/named in the plugin process or in the main process. */ getProxy(proxyId: ProxyIdentifier): T; /** * Register manually created instance. */ set(identifier: ProxyIdentifier, instance: R): R; } export declare class ProxyIdentifier { readonly isMain: boolean; readonly id: string; constructor(isMain: boolean, id: string | T); } export declare function createProxyIdentifier(identifier: string): ProxyIdentifier; export interface ConnectionClosedError extends Error { code: 'RPC_PROTOCOL_CLOSED'; } export declare namespace ConnectionClosedError { function create(message?: string): ConnectionClosedError; function is(error: unknown): error is ConnectionClosedError; } export declare class RPCProtocolImpl implements RPCProtocol { private readonly locals; private readonly proxies; private readonly rpc; private readonly toDispose; constructor(channel: Channel); handleNotification(method: any, args: any[]): void; handleRequest(method: string, args: any[]): Promise; dispose(): void; protected get isDisposed(): boolean; getProxy(proxyId: ProxyIdentifier): T; protected createProxy(proxyId: string): T; /** * Return whether the given property represents a notification. If true, * the promise returned from the invocation will resolve immediately to `undefined` * * A property leads to a notification rather than a method call if its name * begins with `notify` or `on`. * * @param p - The property being called on the proxy. * @return Whether `p` represents a notification. */ protected isNotification(p: PropertyKey): boolean; set(identifier: ProxyIdentifier, instance: R): R; } /** * Wraps and underlying channel to send/receive multiple messages in one go: * - multiple messages to be sent from one stack get sent in bulk at `process.nextTick`. * - each incoming message is handled in a separate `process.nextTick`. */ export declare class BatchingChannel implements Channel { protected underlyingChannel: Channel; protected messagesToSend: Uint8Array[]; constructor(underlyingChannel: Channel); protected onMessageEmitter: Emitter; get onMessage(): Event; readonly onClose: Event; readonly onError: Event; close(): void; getWriteBuffer(): WriteBuffer; protected commitSingleMessage(msg: Uint8Array): void; protected sendAccumulated(): void; protected handleMessages(buffer: ReadBuffer): void; } export declare const enum MsgPackExtensionTag { Uri = 2, Range = 3, VsCodeUri = 4, BinaryBuffer = 5 } export declare function registerMsgPackExtensions(): void; //# sourceMappingURL=rpc-protocol.d.ts.map