fix(lsp): allow long jdtls workspace builds and make Java launch resolution cancellable (#449)

java/buildWorkspace builds the whole imported jdtls workspace, and its 5-minute cap failed launches in large multi-module projects. The budget is now 20 minutes, and the timeout error names it so a real stall can be told apart.

Waiting that long needs a way out, so java_resolve_launch now takes a RequestId and is cancellable locally and over remote. The token reaches the jdtls ready and import waits, the requests (sending $/cancelRequest), and the external build. Stopping a run session during this phase cancels silently and does not launch. Starting a debug session passes a request id but has no stop path yet.

Closes #373

Co-authored-by: a-rookie-of-C-language <[email protected]>
This commit is contained in:
arookieofcanda-rookie-of-C-language authored and GitHub committed 2026-10-30 23:02:20 +08:00
1 parent 14c7821cf4
commit d5fe771eed
8 files changed
+245 -39

No files matched your search

+2 -2
View File
@@ -5,7 +5,7 @@
* JVMs started by Maven / Gradle with a JDWP agent are attached to.
*/
import { executeAction } from "@/platform/actions";
import { call, commands, IpcError, type LaunchConfig, type RunConfig } from "@/platform/ipc";
import { call, commands, IpcError, nextRequestId, type LaunchConfig, type RunConfig } from "@/platform/ipc";
import {
formatCompileErrors,
isJvmApplication,
@@ -76,7 +76,7 @@ export async function javaLaunchConfig(rc: RunConfig, root: string): Promise<Lau
const cwd = rc.cwd ? join(root, rc.cwd) : root;
const parsed = parseJavaArgs(rc.args);
if (!parsed.mainClass) throw new Error(`No main class in '${rc.name}'`);
const info = await call(commands.javaResolveLaunch(module, parsed.classpath === "test", true));
const info = await call(commands.javaResolveLaunch(module, parsed.classpath === "test", true, nextRequestId()));
if (info.errorCount > 0)
notifications().notify({
group: "run",