feat: allow per-server request/init timeout overrides
Merged
MI
2mo ago+260+260+012345678901234567890123456789-8-8-0123456789
Summary
- Some LSP servers (e.g.
kotlin-language-serveron a multi-module Gradle project) take far longer to answerinitializeor individual requests than the global defaults (60s / 15s) allow, causing spurious timeouts even though the server would eventually respond. - Adds optional
requestTimeoutMs/initTimeoutMsfields to a server entry in.pi/lsp-client.json/~/.pi/lsp-client.json, so a slow server can be given more headroom without changing the defaults for every other server. - Global defaults (
REQUEST_TIMEOUT_MS= 15s,INIT_TIMEOUT_MS= 60s) are unchanged; overrides are opt-in per server and fall back to the defaults when omitted.
Changes
src/lsp/types.ts: addrequestTimeoutMs?/initTimeoutMs?toLspServerConfig/ResolvedServer.src/lsp/config-loader.ts: parse the two new fields fromLspEntryinto the resolved server config.src/lsp/transport.ts:sendRequestnow usesthis.server.requestTimeoutMs ?? REQUEST_TIMEOUT_MS.src/lsp/manager.ts: trackinitTimeoutMsper managed client so the idle reaper and warmup path respect an override instead of the fixed manager-wide value.README.md: document the new fields with akotlin-language-serverexample.
Test plan
-
npm run check(tsgo + biome) passes -
npm testpasses: 81/81 (77 existing + 4 new)test/manager.test.ts: override longer/shorter than manager default, reaper behavior in each casetest/transport.test.ts: newUnresponsiveHarnesscovers default timeout and a longer override not firing early
Summary by cubic
Allows per-server overrides for request and init timeouts so slow LSP servers (e.g. kotlin-language-server on a large multi-module Gradle project) don't spuriously time out against the global 15s/60s defaults.
- Adds optional
requestTimeoutMs/initTimeoutMsfields to a server entry in.pi/lsp-client.json/~/.pi/lsp-client.json; only finite positive numbers are accepted, anything else is ignored. - Fixes propagation so the overrides reach the transport's request timeout and the manager's init reaper and warmup paths.
- Overrides fall back to the global defaults when omitted; the defaults stay unchanged.