fix: increase LSP initialize timeout for JDTLS and KotlinLS#25649
Open
norbu35 wants to merge 3 commits intoanomalyco:devfrom
Open
fix: increase LSP initialize timeout for JDTLS and KotlinLS#25649norbu35 wants to merge 3 commits intoanomalyco:devfrom
norbu35 wants to merge 3 commits intoanomalyco:devfrom
Conversation
JDTLS (Eclipse JDT Language Server) and KotlinLS are JVM-based language servers that must perform Gradle project sync and workspace indexing during LSP initialize. For real-world projects this routinely takes 60-180 seconds, well above the default 45 s timeout. Add an optional initializeTimeout field to the LSP server Handle interface so built-in servers can declare their timeout needs. Use it in the client with the existing 45 s constant as the default. Set 180 s for JDTLS and KotlinLS, both of which run on the JVM and trigger Gradle sync during initialization. Closes anomalyco#23982
This was referenced May 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue for this PR
Closes #23982
Type of change
What does this PR do?
JDTLS and KotlinLS are JVM-based language servers. During the LSP
initializehandshake they run Gradle project sync and workspace indexing, which takes 60–180 seconds on real projects. The hardcoded 45 s timeout causes everylsp_diagnosticscall to fail withLSP request timeout (method: initialize).The fix adds an optional
initializeTimeoutfield to theLSPServer.Handleinterface so built-in servers can declare their timeout needs. The client uses it withinput.server.initializeTimeout ?? INITIALIZE_TIMEOUT_MS, so the default 45 s is preserved for every other server. JDTLS and KotlinLS both setinitializeTimeout: 180_000.Changes:
packages/opencode/src/lsp/server.ts— addinitializeTimeout?: numbertoHandle; set180_000for JDTLS and KotlinLSpackages/opencode/src/lsp/client.ts— use per-server timeout with 45 s fallbackNo other servers are affected.
How did you verify your code works?
bun typecheckpasses across all 19 packagesbun test test/lsp/— 31 pass, 0 failbun test test/config/lsp.test.ts— 9 pass, 0 fail??fallback — ifinitializeTimeoutis undefined (every server except JDTLS/KotlinLS), behavior is identical to beforeScreenshots / recordings
N/A — no UI changes.
Checklist