return { "mfussenegger/nvim-dap", dependencies = { "rcarriga/nvim-dap-ui", "nvim-neotest/nvim-nio", "mason-org/mason.nvim", "jay-babu/mason-nvim-dap.nvim", "theHamsta/nvim-dap-virtual-text", }, keys = { { "", function() require("dap").continue() end, desc = "Debug: Start/Continue", }, { "Ds", function() require("dap").continue() end, desc = "Debug: Start/Continue", }, { "", function() require("dap").step_into() end, desc = "Debug: Step Into", }, { "Di", function() require("dap").step_into() end, desc = "Debug: Step Into", }, { "", function() require("dap").step_over() end, desc = "Debug: Step Over", }, { "Do", function() require("dap").step_over() end, desc = "Debug: Step Over", }, { "", function() require("dap").step_out() end, desc = "Debug: Step Out", }, { "DO", function() require("dap").step_out() end, desc = "Debug: Step Out", }, { "", function() require("dap").toggle_breakpoint() end, desc = "Debug: Toggle Breakpoint", }, { "Db", function() require("dap").toggle_breakpoint() end, desc = "Debug: Toggle Breakpoint", }, { "DB", function() require("dap").set_breakpoint(vim.fn.input("Breakpoint condition: ")) end, desc = "Debug: Set Conditional Breakpoint", }, { "Dt", function() require("dapui").toggle() end, desc = "Debug: Toggle UI", }, { "Dl", function() require("dap").run_last() end, desc = "Debug: Run Last Configuration", }, }, config = function() local dap = require("dap") local dapui = require("dapui") -- optional require("mason-nvim-dap").setup({ automatic_installation = true, handlers = {}, ensure_installed = { "codelldb", }, }) -- Dap UI setup dapui.setup({ icons = { expanded = "▾", collapsed = "▸", current_frame = "*" }, controls = { icons = { pause = "⏸", play = "▶", step_into = "⏎", step_over = "⏭", step_out = "⏮", step_back = "b", run_last = "▶▶", terminate = "⏹", disconnect = "⏏", }, }, }) -- Automatically open/close DAP UI dap.listeners.after.event_initialized["dapui_config"] = dapui.open dap.listeners.before.event_terminated["dapui_config"] = dapui.close dap.listeners.before.event_exited["dapui_config"] = dapui.close -- Setup virtual text to show variable values inline require("nvim-dap-virtual-text").setup() -- Setup Rust & React DAPs here dap.adapters.codelldb = { type = "server", port = "${port}", executable = { command = vim.fn.exepath("codelldb"), args = { "--port", "${port}" }, }, } dap.configurations.rust = { { name = "Launch file", type = "codelldb", request = "launch", program = function() return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/target/debug/", "file") end, cwd = "${workspaceFolder}", stopOnEntry = false, }, } end, }