fix: use rest params in LSP sendNotification to avoid undefined serialization (#2185)
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
@@ -114,7 +114,9 @@ export class LSPClientTransport {
|
|||||||
read()
|
read()
|
||||||
}
|
}
|
||||||
|
|
||||||
protected async sendRequest<T>(method: string, params?: unknown): Promise<T> {
|
protected sendRequest<T>(method: string): Promise<T>
|
||||||
|
protected sendRequest<T>(method: string, params: unknown): Promise<T>
|
||||||
|
protected async sendRequest<T>(method: string, ...args: [] | [unknown]): Promise<T> {
|
||||||
if (!this.connection) throw new Error("LSP client not started")
|
if (!this.connection) throw new Error("LSP client not started")
|
||||||
|
|
||||||
if (this.processExited || (this.proc && this.proc.exitCode !== null)) {
|
if (this.processExited || (this.proc && this.proc.exitCode !== null)) {
|
||||||
@@ -130,7 +132,7 @@ export class LSPClientTransport {
|
|||||||
}, this.REQUEST_TIMEOUT)
|
}, this.REQUEST_TIMEOUT)
|
||||||
})
|
})
|
||||||
|
|
||||||
const requestPromise = this.connection.sendRequest(method, params) as Promise<T>
|
const requestPromise = this.connection.sendRequest(method, ...args) as Promise<T>
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const result = await Promise.race([requestPromise, timeoutPromise])
|
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.connection) return
|
||||||
if (this.processExited || (this.proc && this.proc.exitCode !== null)) return
|
if (this.processExited || (this.proc && this.proc.exitCode !== null)) return
|
||||||
this.connection.sendNotification(method, params)
|
this.connection.sendNotification(method, ...args)
|
||||||
}
|
}
|
||||||
|
|
||||||
isAlive(): boolean {
|
isAlive(): boolean {
|
||||||
|
|||||||
Reference in New Issue
Block a user