import { Message, NotificationMessage, CancellationToken, RequestHandler0, RequestHandler, GenericRequestHandler, NotificationHandler0, NotificationHandler, GenericNotificationHandler, ProgressType, Trace, Tracer, TraceOptions, Disposable, Event, MessageReader, MessageWriter, Logger, ConnectionStrategy, ConnectionOptions, RequestType0, RequestType, NotificationType0, NotificationType } from 'vscode-jsonrpc'; import { ProtocolRequestType, ProtocolRequestType0, ProtocolNotificationType, ProtocolNotificationType0 } from './messages'; export interface ProtocolConnection { /** * Sends a request and returns a promise resolving to the result of the request. * * @param type The type of request to sent. * @param token An optional cancellation token. * @returns A promise resolving to the request's result. */ sendRequest(type: ProtocolRequestType0, token?: CancellationToken): Promise; sendRequest(type: RequestType0, token?: CancellationToken): Promise; /** * Sends a request and returns a promise resolving to the result of the request. * * @param type The type of request to sent. * @param params The request's parameter. * @param token An optional cancellation token. * @returns A promise resolving to the request's result. */ sendRequest(type: ProtocolRequestType, params: P, token?: CancellationToken): Promise; sendRequest(type: RequestType, params: P, token?: CancellationToken): Promise; /** * Sends a request and returns a promise resolving to the result of the request. * * @param method the request's method name. * @param token An optional cancellation token. * @returns A promise resolving to the request's result. */ sendRequest(method: string, token?: CancellationToken): Promise; /** * Sends a request and returns a promise resolving to the result of the request. * * @param method the request's method name. * @param params The request's parameter. * @param token An optional cancellation token. * @returns A promise resolving to the request's result. */ sendRequest(method: string, param: any, token?: CancellationToken): Promise; /** * Installs a request handler. * * @param type The request type to install the handler for. * @param handler The actual handler. */ onRequest(type: ProtocolRequestType0, handler: RequestHandler0): Disposable; onRequest(type: RequestType0, handler: RequestHandler0): Disposable; /** * Installs a request handler. * * @param type The request type to install the handler for. * @param handler The actual handler. */ onRequest(type: ProtocolRequestType, handler: RequestHandler): Disposable; onRequest(type: RequestType, handler: RequestHandler): Disposable; /** * Installs a request handler. * * @param methods The method name to install the handler for. * @param handler The actual handler. */ onRequest(method: string, handler: GenericRequestHandler): Disposable; /** * Sends a notification. * * @param type the notification's type to send. */ sendNotification(type: NotificationType0): void; sendNotification(type: ProtocolNotificationType0): void; /** * Sends a notification. * * @param type the notification's type to send. * @param params the notification's parameters. */ sendNotification(type: ProtocolNotificationType, params?: P): void; sendNotification

(type: NotificationType

, params?: P): void; /** * Sends a notification. * * @param method the notification's method name. */ sendNotification(method: string): void; /** * Sends a notification. * * @param method the notification's method name. * @param params the notification's parameters. */ sendNotification(method: string, params: any): void; /** * Installs a notification handler. * * @param type The notification type to install the handler for. * @param handler The actual handler. */ onNotification(type: ProtocolNotificationType0, handler: NotificationHandler0): Disposable; onNotification(type: NotificationType0, handler: NotificationHandler0): Disposable; /** * Installs a notification handler. * * @param type The notification type to install the handler for. * @param handler The actual handler. */ onNotification(type: ProtocolNotificationType, handler: NotificationHandler

): Disposable; onNotification

(type: NotificationType

, handler: NotificationHandler

): Disposable; /** * Installs a notification handler. * * @param methods The method name to install the handler for. * @param handler The actual handler. */ onNotification(method: string, handler: GenericNotificationHandler): Disposable; /** * Installs a progress handler for a given token. * @param type the progress type * @param token the token * @param handler the handler */ onProgress

(type: ProgressType

, token: string | number, handler: NotificationHandler

): Disposable; /** * Sends progress. * @param type the progress type * @param token the token to use * @param value the progress value */ sendProgress

(type: ProgressType

, token: string | number, value: P): void; /** * Enables tracing mode for the connection. */ trace(value: Trace, tracer: Tracer, sendNotification?: boolean): void; trace(value: Trace, tracer: Tracer, traceOptions?: TraceOptions): void; /** * An event emitter firing when an error occurs on the connection. */ onError: Event<[Error, Message | undefined, number | undefined]>; /** * An event emitter firing when the connection got closed. */ onClose: Event; /** * An event emiiter firing when the connection receives a notification that is not * handled. */ onUnhandledNotification: Event; /** * An event emitter firing when the connection got disposed. */ onDispose: Event; /** * Ends the connection. */ end(): void; /** * Actively disposes the connection. */ dispose(): void; /** * Turns the connection into listening mode */ listen(): void; } export declare function createProtocolConnection(input: MessageReader, output: MessageWriter, logger?: Logger, options?: ConnectionStrategy | ConnectionOptions): ProtocolConnection;