mirror of
https://github.com/pratiktri/dotfiles.git
synced 2026-02-05 00:41:44 +05:30
- Remove relic of effort to force neovim in vs-code - Remove util functions copied from LazyNvim - if I need them I'll write them - Removed Lua code comments I don't understand - Better code comments
166 lines
4.4 KiB
Lua
166 lines
4.4 KiB
Lua
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 = {
|
|
{
|
|
"<F5>",
|
|
function()
|
|
require("dap").continue()
|
|
end,
|
|
desc = "Debug: Start/Continue",
|
|
},
|
|
{
|
|
"<leader>Ds",
|
|
function()
|
|
require("dap").continue()
|
|
end,
|
|
desc = "Debug: Start/Continue",
|
|
},
|
|
{
|
|
"<F11>",
|
|
function()
|
|
require("dap").step_into()
|
|
end,
|
|
desc = "Debug: Step Into",
|
|
},
|
|
{
|
|
"<leader>Di",
|
|
function()
|
|
require("dap").step_into()
|
|
end,
|
|
desc = "Debug: Step Into",
|
|
},
|
|
{
|
|
"<F10>",
|
|
function()
|
|
require("dap").step_over()
|
|
end,
|
|
desc = "Debug: Step Over",
|
|
},
|
|
{
|
|
"<leader>Do",
|
|
function()
|
|
require("dap").step_over()
|
|
end,
|
|
desc = "Debug: Step Over",
|
|
},
|
|
{
|
|
"<S-F11>",
|
|
function()
|
|
require("dap").step_out()
|
|
end,
|
|
desc = "Debug: Step Out",
|
|
},
|
|
{
|
|
"<leader>DO",
|
|
function()
|
|
require("dap").step_out()
|
|
end,
|
|
desc = "Debug: Step Out",
|
|
},
|
|
{
|
|
"<F9>",
|
|
function()
|
|
require("dap").toggle_breakpoint()
|
|
end,
|
|
desc = "Debug: Toggle Breakpoint",
|
|
},
|
|
{
|
|
"<leader>Db",
|
|
function()
|
|
require("dap").toggle_breakpoint()
|
|
end,
|
|
desc = "Debug: Toggle Breakpoint",
|
|
},
|
|
{
|
|
"<leader>DB",
|
|
function()
|
|
require("dap").set_breakpoint(vim.fn.input("Breakpoint condition: "))
|
|
end,
|
|
desc = "Debug: Set Conditional Breakpoint",
|
|
},
|
|
{
|
|
"<leader>Dt",
|
|
function()
|
|
require("dapui").toggle()
|
|
end,
|
|
desc = "Debug: Toggle UI",
|
|
},
|
|
{
|
|
"<leader>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,
|
|
}
|