neovim-confs/lua/lazyvim/plugins/extras/dap/nlua.lua

44 lines
1.1 KiB
Lua
Raw Permalink Normal View History

2024-01-11 11:44:26 +01:00
return {
"mfussenegger/nvim-dap",
dependencies = {
{
"jbyuki/one-small-step-for-vimkind",
-- stylua: ignore
config = function()
local dap = require("dap")
dap.adapters.nlua = function(callback, conf)
local adapter = {
type = "server",
host = conf.host or "127.0.0.1",
port = conf.port or 8086,
}
if conf.start_neovim then
local dap_run = dap.run
dap.run = function(c)
adapter.port = c.port
adapter.host = c.host
end
require("osv").run_this()
dap.run = dap_run
end
callback(adapter)
end
dap.configurations.lua = {
{
type = "nlua",
request = "attach",
name = "Run this file",
start_neovim = {},
},
{
type = "nlua",
request = "attach",
name = "Attach to running Neovim instance (port = 8086)",
port = 8086,
},
}
end,
},
},
}