-
-
Notifications
You must be signed in to change notification settings - Fork 36
DAP support lua
Zeioth edited this page Aug 14, 2023
·
2 revisions
Nothing special needs to be done for lua.
Please note that this section has nothing to do with compiler.nvim. I'm documenting this to make your life easier. To debug lua with DAP you have to:
- Install the plugin
[one-small-step-for-vimkind](https://github.com/jbyuki/one-small-step-for-vimkind)
and add it as dependency ofDAP
. - That installs the adapter, so you don't need to do it through
mason dap
.
local dap = require("dap")
-- Lua
dap.adapters.nlua = function(callback, config)
callback({ type = 'server', host = config.host or "127.0.0.1", port = config.port or 8086 })
end
dap.configurations.lua = {
{
type = 'nlua',
request = 'attach',
name = "Attach to running Neovim instance",
program = function() pcall(require"osv".launch({port = 8086})) end,
}
}
All there is left to do is adding a breakpoint to your code, and run :DapContinue
- Note that the debugger is included in
one-small-step-for-vimkind
. You don't need to install any system dependency. - If you find any issue while configuring DAP, run
:DapSetLogLevel trace
and:DapShowLog
to find the reason.