The Debug Adapter Protocol is a REPL protocol in disguise
6 days ago
- #Debug Adapter Protocol
- #REPL
- #Neovim
- The Debug Adapter Protocol (DAP) is primarily designed for debugging but works well as a REPL interface.
- DAP's `evaluate` command allows for expression evaluation, returning results with structured data via `variablesReference`.
- The protocol supports nested data structures and cyclic references through the `variables` command.
- Additional REPL-like features in DAP include completion via the `completions` command and variable definition location lookup.
- Implementing a REPL with DAP requires handling some debugging-specific features like breakpoints and session initialization.
- The motivation for using DAP as a REPL includes reusing existing UI elements and avoiding the development of a new interface.