| 2336 | public onRequest<P, R, E, RO>(type: RequestType<P, R, E, RO>, handler: RequestHandler<P, R, E>): void; |
| 2337 | public onRequest<R, E>(method: string, handler: GenericRequestHandler<R, E>): void; |
| 2338 | public onRequest<R, E>(type: string | RPCMessageType, handler: GenericRequestHandler<R, E>): void { |
| 2339 | if (!this.isConnectionActive()) { |
| 2340 | throw new Error('Language client is not ready yet'); |
| 2341 | } |
| 2342 | try { |
| 2343 | this._resolvedConnection!.onRequest(type, handler); |
| 2344 | } catch (error) { |
| 2345 | this.error(`Registering request handler ${Is.string(type) ? type : type.method} failed.`, error); |
| 2346 | throw error; |
| 2347 | } |
| 2348 | } |
| 2349 | |
| 2350 | public sendNotification<RO>(type: NotificationType0<RO>): void; |
| 2351 | public sendNotification<P, RO>(type: NotificationType<P, RO>, params?: P): void; |