Add Go Debugger #1

Merged
Snoweuph merged 2 commits from SZUT-Dominik/Dotfiles:neo into neo 2024-05-31 16:13:55 +00:00
3 changed files with 67 additions and 43 deletions
Showing only changes of commit a09e5f53c1 - Show all commits

View file

@ -1 +1 @@
neovim lua gcc curl wget git unzip tar gzip ripgrep php composer go nodejs npm neovim lua gcc curl wget git unzip tar gzip ripgrep php composer go nodejs npm delve

View file

@ -0,0 +1,6 @@
return {
"leoluz/nvim-dap-go",
config = function()
require("dap-go").setup()
end
}

View file

@ -1,57 +1,75 @@
return { return {
"mfussenegger/nvim-dap", {
dependencies = { "mfussenegger/nvim-dap",
"rcarriga/nvim-dap-ui", dependencies = {
"nvim-neotest/nvim-nio", "rcarriga/nvim-dap-ui",
}, "nvim-neotest/nvim-nio",
config = function() },
-- Setup Debugging -- config = function()
local dap = require("dap") -- Setup Debugging --
local dap = require("dap")
-- Open UI on Debugging -- -- Open UI on Debugging --
local dapui = require("dapui").setup() local dapui = require("dapui")
dap.listeners.before.attach.dapui_config = function() dapui.setup({
dapui.open() layouts = {
end {
dap.listeners.before.launch.dapui_config = function() elements = {
dapui.open() { id = "scopes", size = 0.65 },
end { id = "breakpoints", size = 0.35 },
dap.listeners.before.event_terminated.dapui_config = function() },
dapui.close() position = "left",
end size = 40,
dap.listeners.before.event_exited.dapui_config = function() },
dapui.close() {
end elements = {
{ id = "repl", size = 0.5 },
{ id = "console", size = 0.5 },
},
position = "bottom",
size = 10,
},
},
})
dap.listeners.before.attach.dapui_config = function()
dapui.open()
end
dap.listeners.before.launch.dapui_config = function()
dapui.open()
end
-- Keybinding -- -- Keybinding --
vim.keymap.set("n", "<Leader>db", dap.toggle_breakpoint, { desc = "Toggle Breakpoint" }) vim.keymap.set("n", "<Leader>dt", dapui.toggle, { desc = "Toggle Debugger UI" })
vim.keymap.set("n", "<Leader>dc", dap.continue, { desc = "Debugger Continue" }) vim.keymap.set("n", "<Leader>db", dap.toggle_breakpoint, { desc = "Toggle Breakpoint" })
vim.keymap.set("n", "<Leader>dx", dap.terminate, { desc = "Debugger Terminate" }) vim.keymap.set("n", "<Leader>dc", dap.continue, { desc = "Debugger Continue" })
vim.keymap.set("n", "<Leader>ds", dap.step_over, { desc = "Debugger Step Over" }) vim.keymap.set("n", "<Leader>dx", dap.terminate, { desc = "Debugger Terminate" })
vim.keymap.set("n", "<Leader>ds", dap.step_over, { desc = "Debugger Step Over" })
-- Breakpoints -- -- Breakpoints --
vim.api.nvim_set_hl(0, "DapBreakpoint", { ctermbg = 0, fg = "#993939", bg = "#31353f" }) vim.api.nvim_set_hl(0, "DapBreakpoint", { ctermbg = 0, fg = "#993939", bg = "#31353f" })
vim.api.nvim_set_hl(0, "DapLogPoint", { ctermbg = 0, fg = "#61afef", bg = "#31353f" }) vim.api.nvim_set_hl(0, "DapLogPoint", { ctermbg = 0, fg = "#61afef", bg = "#31353f" })
vim.api.nvim_set_hl(0, "DapStopped", { ctermbg = 0, fg = "#98c379", bg = "#31353f" }) vim.api.nvim_set_hl(0, "DapStopped", { ctermbg = 0, fg = "#98c379", bg = "#31353f" })
vim.fn.sign_define( vim.fn.sign_define(
"DapBreakpoint", "DapBreakpoint",
{ text = "", texthl = "DapBreakpoint", linehl = "DapBreakpoint", numhl = "DapBreakpoint" } { text = "", texthl = "DapBreakpoint", linehl = "DapBreakpoint", numhl = "DapBreakpoint" }
) )
vim.fn.sign_define( vim.fn.sign_define(
"DapBreakpointCondition", "DapBreakpointCondition",
{ text = "󰣏", texthl = "DapBreakpoint", linehl = "DapBreakpoint", numhl = "DapBreakpoint" } { text = "󰣏", texthl = "DapBreakpoint", linehl = "DapBreakpoint", numhl = "DapBreakpoint" }
) )
vim.fn.sign_define( vim.fn.sign_define(
"DapBreakpointRejected", "DapBreakpointRejected",
{ text = "", texthl = "DapBreakpoint", linehl = "DapBreakpoint", numhl = "DapBreakpoint" } { text = "", texthl = "DapBreakpoint", linehl = "DapBreakpoint", numhl = "DapBreakpoint" }
) )
vim.fn.sign_define( vim.fn.sign_define(
"DapLogPoint", "DapLogPoint",
{ text = "", texthl = "DapLogPoint", linehl = "DapLogPoint", numhl = "DapLogPoint" } { text = "", texthl = "DapLogPoint", linehl = "DapLogPoint", numhl = "DapLogPoint" }
) )
vim.fn.sign_define( vim.fn.sign_define(
"DapStopped", "DapStopped",
{ text = "", texthl = "DapStopped", linehl = "DapStopped", numhl = "DapStopped" } { text = "", texthl = "DapStopped", linehl = "DapStopped", numhl = "DapStopped" }
) )
end, end,
},
require("plugins.editor.debugger.debugger_go"),
} }