65 lines
2.5 KiB
Lua
65 lines
2.5 KiB
Lua
return {
|
|
{
|
|
"mfussenegger/nvim-dap",
|
|
event = "VeryLazy",
|
|
dependencies = {
|
|
"nvim-neotest/nvim-nio", -- dependency of nvim-dap-ui below
|
|
"rcarriga/nvim-dap-ui",
|
|
"jay-babu/mason-nvim-dap.nvim", -- requires mason.nvim
|
|
"theHamsta/nvim-dap-virtual-text", -- TODO: decide if i want this or not
|
|
},
|
|
config = function()
|
|
local dap = require("dap")
|
|
local dap_ui = require("dapui")
|
|
local mason_dap = require("mason-nvim-dap")
|
|
local dap_virtual_text = require("nvim-dap-virtual-text")
|
|
|
|
dap_virtual_text.setup()
|
|
|
|
mason_dap.setup({
|
|
ensure_installed = { "cppdbg" }, -- "codelldb", "lldb", "gdb", "cppdbg"
|
|
automatic_installation = true,
|
|
handlers = {
|
|
function(config) require("mason-nvim-dap").default_setup(config) end,
|
|
},
|
|
})
|
|
|
|
dap.configurations = {
|
|
c = {
|
|
{
|
|
name = "launch file",
|
|
type = "cppdbg",
|
|
request = "launch",
|
|
cwd = "${workspaceFolder}",
|
|
program = function()
|
|
return vim.fn.input("path to executable: ", vim.fn.getcwd() .. "/", "file")
|
|
end,
|
|
MIMode = "lldb",
|
|
stopAtEntry = false,
|
|
},
|
|
{
|
|
name = "attach to lldbserver :1234",
|
|
type = "cppdbg",
|
|
request = "launch",
|
|
cwd = "${workspaceFolder}",
|
|
program = function()
|
|
return vim.fn.input("path to executable: ", vim.fn.getcwd() .. "/", "file")
|
|
end,
|
|
MIMode = "lldb",
|
|
miDebuggerServerAddress = "localhost:1234",
|
|
miDebuggerPath = "/usr/bin/lldb",
|
|
},
|
|
},
|
|
}
|
|
|
|
dap_ui.setup()
|
|
vim.fn.sign_define("DapBreakpoint", { text = "🟥" })
|
|
dap.listeners.before.attach.dapui_config = function() dap_ui.open() end
|
|
dap.listeners.before.launch.dapui_config = function() dap_ui.open() end
|
|
dap.listeners.before.event_terminated.dapui_config = function() dap_ui.close() end
|
|
dap.listeners.before.event_exited.dapui_config = function() dap_ui.close() end
|
|
end,
|
|
},
|
|
}
|
|
|