Skip to content

feat(neovim): blackbox.nvim — Blackbox for Neovim on nvim-dap - #1

Open
akash-aman wants to merge 2 commits into
mainfrom
feat/neovim
Open

akash-aman wants to merge 2 commits into
mainfrom
feat/neovim

Conversation

@akash-aman

Copy link
Copy Markdown
Collaborator

Summary

Adds blackbox.nvim, the Neovim side of Blackbox, built in Lua on top of nvim-dap. It speaks the same window protocol as the VS Code extension (a private socket and registry entry in /tmp/blackbox-<uid>/), so the existing MCP server lists Neovim windows next to VS Code, Cursor and Antigravity ones, with no server changes.

  • Tools: all 31 non-ide_* tools from schema/tools.json, plus window_status:
    • breakpoints: source, function, hit counts, logpoints, enable/disable;
    • starting by launch configuration name (.vscode/launch.json and dap.configurations);
    • wait for stop, step, continue, pause, run to line;
    • threads, frames, variables, evaluate, inspect, set variable, watches;
    • source context, output, and the editor/workspace tools.
  • Window choice: an AI tool started in Neovim's :terminal uses that Neovim automatically.
  • Startup failures: debug_start reports a refused launch with the adapter's own reason, and explains a start that never comes up instead of hanging.
  • Commands: :BlackboxStatus, :BlackboxCopyMcpConfig, and :help blackbox.

Testing

  • Lua unit tests: 31, run with plenary. They cover the events hub, protocol/private folder, server framing, breakpoint stores, request failure on session close, and argument handling.

  • New conformance suite (editors/conformance, 7 tests): it drives a headless Neovim through the real MCP server, against a Go fixture debugged by delve. Steps covered:

    • start by name, wait, step, logpoints;
    • hit count, threads, frames, set variable, enable/disable, function breakpoints, run to line;
    • tools after a stop;
    • a refused launch and a stalled start.

    The suite is editor-independent, so a future JetBrains plugin can reuse it.

  • CI: .github/workflows/neovim.yml runs both on Linux and macOS.

  • Manual: run in a real Neovim config against a WordPress site with Xdebug: start by name, breakpoint, step into, function breakpoint on wp(), set $query_vars, stop. Also tested with Go/delve.

  • VS Code: its unit tests are unchanged and pass (104).

Notes

  • The MCP server still ships with the VS Code extension (~/.blackbox/blackbox-mcp.js). A standalone npm package for Neovim-only users is a follow-up.
  • lazy.nvim installs from a repo root, so publishing for lazy.nvim users needs a separate blackbox.nvim repo, also a follow-up. Until then, install it with dir = ".../editors/neovim".
  • The Neovim workflow also runs on pushes to feat/** branches.

Adds the Neovim window side of Blackbox, in Lua on top of nvim-dap. It
speaks the same window protocol as the VS Code extension (private
socket + registry entry in /tmp/blackbox-<uid>/, newline-delimited JSON
requests), so the existing MCP server lists Neovim next to VS Code,
Cursor and Antigravity windows with no server changes. An AI tool
started in Neovim's :terminal is matched to that Neovim automatically.

- Implements all 31 non-ide tools from schema/tools.json plus
  window_status: breakpoints (source, function, hit counts, logpoints,
  enable/disable), start by launch configuration name (.vscode/
  launch.json and dap.configurations), wait for stop, step/continue/
  pause/run-to-line, threads, frames, variables, evaluate, inspect,
  set variable, watches, source context, output, editor and workspace
  tools.
- Events hub ported from debugEvents.ts onto dap.listeners: per-thread
  pause state, output buffer with size limits and filtering, waits
  armed before requests, `next`.
- debug_start reports a refused launch with the adapter's reason and
  explains a start that never comes up instead of hanging.
- Robust against sessions that end without a terminated event (via
  on_close), requests on closed sessions, JSON null arguments, nested
  node_modules, partial buffer-name matches, child sessions.
- :BlackboxStatus and :BlackboxCopyMcpConfig; :help blackbox.

Tests: 31 Lua unit tests (plenary) and a new editor-independent
conformance suite (editors/conformance) that drives a headless Neovim
through the real MCP server against a Go fixture debugged by delve
(7 tests). CI: .github/workflows/neovim.yml on Linux and macOS.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant