A nvim-lua debug adapter for use with nvim-dap.
Supported features:
- Evaluate expressions (Watch demo)
- Logpoints with optional conditions (Watch demo)
Other features like stopping at breakpoints, is not supported due to the architecture of this plugin. Both Client and debug adapter cannot run in the same thread if a breakpoint needs to pause execution.
The main goal for this is to have an interactive REPL to query and modify the running nvim instance.
If you're looking for a way to debug Neovim plugins with full breakpoint support you should head to osv.
- Install nvim-dap; it's a dependency
- Install this plugin:
git clone https://github.com/mfussenegger/nluarepl.git \
~/.config/nvim/pack/plugins/start/nluarepl
The plugin automatically registers a nluarepl
adapter for nvim-dap
and
creates a nluarepl
configuration which is always available. You can start it
using :DapNew nluarepl
or via dap.continue()
. Afterwards open the
nvim-dap
REPL using :DapToggleRepl
and start typing expressions.
For longer multi-line statements you can open a dap-eval buffer using :sp dap-eval://lua
and then execute expressions via :w
inside that buffer.
-
Logpoints won't work for functions baked into nvim. This includes functions like
vim.split
or other functions defined in shared.lua nluarepl also can't provide source locations for these functions.You can start nvim with
--luamod-dev
to avoid this limitation, but be careful setting logpoints on these functions, some of them are called a lot - and many by nvim-dap/nluarepl - that can result in output spam and a significant slowdown of nvim.
Disclaimer: There's a chance the functionality of this plugin could get included in osv, if that happens this plugin here will be archived.