Skip to content

Commit 8940efc

Browse files
fix(lsp): increase initialize timeout for JDTLS and KotlinLS
Add an optional initializeTimeout override to the LSP server Handle and honour it in the client initialize call, defaulting to 180s for JDTLS and KotlinLS which routinely exceed the 45s default on first project load. Ported from anomalyco#25649 (adapted for the Effect layer). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 1882c33 commit 8940efc

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

packages/opencode/src/lsp/client.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ export async function create(input: {
249249
},
250250
},
251251
}),
252-
INITIALIZE_TIMEOUT_MS,
252+
input.server.initializeTimeout ?? INITIALIZE_TIMEOUT_MS,
253253
).catch((err) => {
254254
throw new InitializeError({ serverID: input.serverID, cause: err })
255255
})

packages/opencode/src/lsp/server.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ const output = (cmd: string[], opts: Process.RunOptions = {}) => Process.text(cm
2525
export interface Handle {
2626
process: ChildProcessWithoutNullStreams
2727
initialization?: Record<string, any>
28+
/** Override the default 45 s initialize-request timeout (ms). */
29+
initializeTimeout?: number
2830
}
2931

3032
type RootFunction = (file: string, ctx: InstanceContext) => Promise<string | undefined>
@@ -1266,6 +1268,7 @@ export const JDTLS: Info = {
12661268
cwd: root,
12671269
},
12681270
),
1271+
initializeTimeout: 180_000,
12691272
}
12701273
},
12711274
}
@@ -1354,6 +1357,7 @@ export const KotlinLS: Info = {
13541357
process: spawn(launcherScript, ["--stdio"], {
13551358
cwd: root,
13561359
}),
1360+
initializeTimeout: 180_000,
13571361
}
13581362
},
13591363
}

0 commit comments

Comments
 (0)