Файли
openidea/src/features/debugger/__tests__/missingAdapter.test.ts
T
l0ng-ai 379a52d6e7 feat(debugger): Kotlin breakpoints through the Kotlin Debug Adapter (#434)
Kotlin line breakpoints never verified through java-debug because jdtls cannot resolve classes for .kt files. Kotlin Application configurations and JDWP attach for modules with Kotlin sources now use the official Kotlin Debug Adapter (installable from the debugger prompt, running on the language-server JDK); pure Java keeps java-debug.

The adapter resolves classes from source paths, so sources whose directories don't match their package are mirrored package-aligned outside the project (symlinks, copies where links fail) and paths are mapped back for breakpoints and stack frames; files that can't be mirrored are skipped rather than failing the session. Kotlin applications start with JDWP suspend=y and a session-owned JDWP relay holds the adapter's early resume until attach completes, so breakpoints are installed before the program runs.

Limitations (docs/kotlin-debugging.md): @file:JvmName facades are not resolved; package/source-root changes need a new session. Not verified on a real Windows machine.

Fixes #374
2026-10-30 18:15:42 +08:00

33 рядки
1.6 KiB
TypeScript

import { describe, expect, it } from "vitest";
import { IpcError } from "@/platform/ipc";
import { missingAdapter } from "../missingAdapter";
const unavailable = (message: string) => new IpcError({ kind: "unavailable", message });
describe("missing debug adapters", () => {
it("offers OpenIDEA's debugpy when the interpreter has none", () => {
const e = unavailable("debugpy is not installed for /opt/homebrew/bin/python3.14. Install OpenIDEA's copy");
expect(missingAdapter("debugpy", e)).toMatchObject({ tool: "debugpy", title: "debugpy is not installed" });
});
it("offers the managed install of a missing adapter binary", () => {
const e = unavailable(
"debug adapter `js-debug` not found (`js-debug-adapter` is neither installed by OpenIDEA nor on PATH)",
);
expect(missingAdapter("js-debug", e)).toMatchObject({
tool: "js-debug",
title: "The JavaScript debugger (vscode-js-debug) is not installed",
});
expect(
missingAdapter("kotlin-debug-adapter", unavailable("debug adapter `kotlin-debug-adapter` not found (x)"))?.tool,
).toBe("kotlin-debug-adapter");
expect(missingAdapter("delve", unavailable("debug adapter `delve` not found (x)"))?.tool).toBe("delve");
});
it("leaves other failures and adapters without an installer alone", () => {
expect(missingAdapter("js-debug", unavailable("connection refused"))).toBeNull();
expect(missingAdapter("js-debug", new Error("debug adapter `js-debug` not found"))).toBeNull();
expect(missingAdapter("lldb-dap", unavailable("debug adapter `lldb-dap` not found (x)"))).toBeNull();
});
});