opts = {
defaults = {
["<leader>d"] = { name = "+debug" },
- ["<leader>da"] = { name = "+adapters" },
},
},
},
opts = {
-- Makes a best effort to setup the various debuggers with
-- reasonable debug configurations
- automatic_setup = true,
+ automatic_installation = true,
-- You can provide additional configuration to the handlers,
-- see mason-nvim-dap README for more information
handlers = {},
-
- -- You'll need to check that you have the required things installed
- -- online, please don't ask me how to install them :)
- ensure_installed = {
- "cpptools",
- },
},
- config = function(_, opts)
- require("mason-nvim-dap").setup(opts)
- local dap = require("dap")
- dap.configurations.cpp = {
- {
- name = "Launch file",
- type = "cppdbg",
- request = "launch",
- program = function()
- return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file")
- end,
- cwd = "${workspaceFolder}",
- stopAtEntry = true,
- },
- }
- end,
},
-
{
"jbyuki/one-small-step-for-vimkind",
-- stylua: ignore
config = function()
local dap = require("dap")
dap.adapters.nlua = function(callback, config)
- callback({ type = "server", host = config.host or "127.0.0.1", port = config.port or 8086 })
+ local adapter = {
+ type = "server",
+ host = config.host or "127.0.0.1",
+ port = config.port or 8086,
+ }
+ if config.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 = "Attach to running Neovim instance",
+ name = "Run this file",
+ start_neovim = {},
+ },
+ {
+ type = "nlua",
+ request = "attach",
+ name = "Attach to running Neovim instance (port 8086)",
+ port = 8086,
},
}
end,