fix(debug): prefer dlv for go directory launches

Prefer directory-capable adapters when selecting a launch adapter for a
resolved directory program. This keeps Go package directories on dlv in
mixed projects that also expose native-debugger root markers such as a
Makefile, instead of selecting gdb/lldb-dap first and rejecting the
directory during validation.

Added a regression test covering a Go module with both go.mod and
Makefile plus local dlv/gdb adapter shims.

Fixes #2020
This commit is contained in:
roboomp
2026-06-07 03:03:57 +00:00
parent 1745529368
commit 8c25f7d4aa
4 changed files with 48 additions and 4 deletions
+1 -1
View File
@@ -687,7 +687,7 @@ export class DebugTool implements AgentTool<typeof debugSchema, DebugToolDetails
const commandCwd = params.cwd ? resolveToCwd(params.cwd, this.session.cwd) : this.session.cwd;
const program = resolveToCwd(params.program, commandCwd);
const programKind = await classifyLaunchProgram(program);
const adapter = selectLaunchAdapter(program, commandCwd, params.adapter);
const adapter = selectLaunchAdapter(program, commandCwd, params.adapter, programKind);
if (!adapter) {
if (params.adapter === "debugpy") {
throw new ToolError("adapter 'debugpy' is not available: python not found in PATH");