diff --git a/src/tools/lsp/lsp-client-transport.ts b/src/tools/lsp/lsp-client-transport.ts index d4590262b..1b6b85c5d 100644 --- a/src/tools/lsp/lsp-client-transport.ts +++ b/src/tools/lsp/lsp-client-transport.ts @@ -114,7 +114,9 @@ export class LSPClientTransport { read() } - protected async sendRequest(method: string, params?: unknown): Promise { + protected sendRequest(method: string): Promise + protected sendRequest(method: string, params: unknown): Promise + protected async sendRequest(method: string, ...args: [] | [unknown]): Promise { if (!this.connection) throw new Error("LSP client not started") if (this.processExited || (this.proc && this.proc.exitCode !== null)) { @@ -130,7 +132,7 @@ export class LSPClientTransport { }, this.REQUEST_TIMEOUT) }) - const requestPromise = this.connection.sendRequest(method, params) as Promise + const requestPromise = this.connection.sendRequest(method, ...args) as Promise try { const result = await Promise.race([requestPromise, timeoutPromise]) @@ -142,10 +144,12 @@ export class LSPClientTransport { } } - protected sendNotification(method: string, params?: unknown): void { + protected sendNotification(method: string): void + protected sendNotification(method: string, params: unknown): void + protected sendNotification(method: string, ...args: [] | [unknown]): void { if (!this.connection) return if (this.processExited || (this.proc && this.proc.exitCode !== null)) return - this.connection.sendNotification(method, params) + this.connection.sendNotification(method, ...args) } isAlive(): boolean {