Open-Source Wikis

/

Zed

/

Systems

/

DAP

zed-industries/zed

DAP

Active contributors: kubkon, Anthony-Eid, osiewicz

Purpose

The DAP system implements a Debug Adapter Protocol client and the surrounding UI. It lets you start, control, and inspect debug sessions for any language with a DAP-compatible adapter.

Crates

Crate Role
crates/dap DAP client (transport + request types + lifecycle)
crates/dap_adapters Per-language adapter wrappers
crates/debugger_ui UI panels: variables, call stack, breakpoints, REPL
crates/debugger_tools Dev helpers: DAP message inspector, fakes
crates/debug_adapter_extension Extension-API surface for third-party adapters

Project::debugger_store owns the per-project DAP session registry; see Project.

Key abstractions

Type File Description
DebugAdapter crates/dap/src/... An LSP-style wrapper over a DAP-speaking process
DapStore / DebuggerStore crates/project/src/debugger.rs Per-project store of running adapters/sessions
Adapter registry crates/dap_adapters Maps language → adapter binary + transport
DebuggerPanel crates/debugger_ui/src/... The in-app debugger panel
BreakpointStore crates/project/src/... (debugger area) Breakpoints across files

How it works

sequenceDiagram
    participant U as User
    participant DP as DebuggerPanel
    participant DS as DebuggerStore
    participant A as DebugAdapter
    participant P as Adapter process

    U->>DP: Start debug "Run main"
    DP->>DS: launch(config)
    DS->>A: spawn adapter
    A->>P: stdio DAP
    A-->>DS: initialized
    DS->>A: setBreakpoints
    DS->>A: launch
    A-->>DP: stoppedEvent
    DP->>DS: continue / step / variables / evaluate

Sessions

A debug session corresponds to one running adapter. Multiple sessions can run simultaneously per project (e.g. server + client). Each session has its own threads, stack frames, breakpoints, and variables tree.

Configuration

Debug configurations live in tasks.json / debug.json per project, similar to VS Code's launch.json. The schema is defined in crates/dap_adapters and validated at parse time.

Inline UI

Beyond the dedicated panel, the editor itself shows:

  • Breakpoint markers in the gutter (with conditional/log breakpoints).
  • Inline values (e.g. x = 42) at the cursor's current frame.
  • Stack-frame highlight on the active line.

Adapter installation

DAP adapters are installed similarly to LSP servers — the adapter wrapper knows how to fetch and validate the binary. Many use the Node runtime; some use system binaries (lldb, delve, dlv, js-debug).

Integration points

  • Below: crates/dap for transport, crates/dap_adapters for adapter registration.
  • Above: crates/debugger_ui panels and the editor's gutter integration.
  • Tests: crates/debugger_tools provides fakes and a DAP message inspector.

Entry points for modification

  • New adapter — crates/dap_adapters/src/<adapter>.rs. Or ship as an extension via crates/debug_adapter_extension.
  • New panel — crates/debugger_ui/src/.
  • DAP transport bug — crates/dap/src/lsp.rs (the file is named after LSP for historical reasons; DAP and LSP share JSON-RPC framing).
  • Debugger — user-facing flow
  • Project — owner of DebuggerStore
  • LSP — sibling protocol with similar architecture

Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.

DAP – Zed wiki | Factory