summaryrefslogtreecommitdiff
path: root/config/nvim/lua/plugins/dap.lua
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--config/nvim/lua/plugins/dap.lua248
1 files changed, 160 insertions, 88 deletions
diff --git a/config/nvim/lua/plugins/dap.lua b/config/nvim/lua/plugins/dap.lua
index 315fab8..6e2de11 100644
--- a/config/nvim/lua/plugins/dap.lua
+++ b/config/nvim/lua/plugins/dap.lua
@@ -1,96 +1,168 @@
return {
- "mfussenegger/nvim-dap",
- config = function()
- local dap = require("dap")
- dap.adapters.go = {
- type = "server",
- port = "${port}",
- executable = {
- command = "dlv",
- args = { "dap", "-l", "127.0.0.1:${port}" },
+ {
+ "mfussenegger/nvim-dap",
+ config = function()
+ local dap = require("dap")
+ dap.adapters.go = {
+ type = "server",
+ port = "${port}",
+ executable = {
+ command = "dlv",
+ args = { "dap", "-l", "127.0.0.1:${port}" },
+ },
+ }
+ end,
+ keys = {
+ {
+ "<F5>",
+ function()
+ require("dap").continue()
+ end,
+ desc = "Debug continue",
+ },
+ {
+ "<F17>",
+ function() -- S-F5
+ require("dap").restart()
+ end,
+ desc = "Debug restart",
+ },
+ {
+ "<F29>",
+ function() -- C-F5
+ require("dap").terminate()
+ end,
+ desc = "Debug terminate",
+ },
+ {
+ "<F8>",
+ function()
+ require("dap").step_over()
+ end,
+ desc = "Debug step over",
+ },
+ {
+ "<F7>",
+ function()
+ require("dap").step_into()
+ end,
+ desc = "Debug step into",
+ },
+ {
+ "<F19>",
+ function() -- S-F7
+ require("dap").step_out()
+ end,
+ desc = "Debug step out",
+ },
+ {
+ "<A-b>",
+ function()
+ require("dap").toggle_breakpoint()
+ end,
+ desc = "Toggle breakpoint",
+ },
+ {
+ "<F9>",
+ function()
+ local widgets = require("dap.ui.widgets")
+ widgets.centered_float(widgets.scopes)
+ end,
+ desc = "Debug scopes",
},
- }
- -- dap.configurations.go = {
- -- {
- -- type = "go",
- -- name = "Debug",
- -- request = "launch",
- -- program = "${file}",
- -- },
- -- {
- -- type = "go",
- -- name = "Debug test",
- -- request = "launch",
- -- mode = "test",
- -- program = "${file}",
- -- },
- -- {
- -- type = "go",
- -- name = "Debug test (go test)",
- -- request = "launch",
- -- mode = "test",
- -- program = "${workspaceFolder}",
- -- },
- -- }
- end,
- keys = {
- {
- "<F5>",
- function()
- require("dap").continue()
- end,
- desc = "Debug continue",
- },
- {
- "<F17>",
- function() -- S-F5
- require("dap").restart()
- end,
- desc = "Debug restart",
- },
- {
- "<F29>",
- function() -- C-F5
- require("dap").terminate()
- end,
- desc = "Debug terminate",
- },
- {
- "<F8>",
- function()
- require("dap").step_over()
- end,
- desc = "Debug step over",
- },
- {
- "<F7>",
- function()
- require("dap").step_into()
- end,
- desc = "Debug step into",
},
- {
- "<F19>",
- function() -- S-F7
- require("dap").step_out()
- end,
- desc = "Debug step out",
+ },
+ {
+ "rcarriga/nvim-dap-ui",
+ dependencies = {
+ "mfussenegger/nvim-dap",
+ "nvim-neotest/nvim-nio",
},
- {
- "<A-b>",
- function()
- require("dap").toggle_breakpoint()
- end,
- desc = "Toggle breakpoint",
+ config = function()
+ local dapui = require("dapui")
+
+ dapui.setup({
+ icons = {
+ expanded = "▼",
+ collapsed = "▶",
+ current_frame = "→",
+ },
+ controls = {
+ enabled = false,
+ },
+ mappings = {
+ open = "o",
+ remove = "d",
+ edit = "e",
+ repl = "r",
+ toggle = "t",
+ },
+ expand_lines = vim.fn.has("nvim-0.7"),
+ layouts = {
+ {
+ elements = {
+ "repl",
+ "scopes",
+ },
+ size = 0.3,
+ position = "bottom",
+ },
+ },
+ floating = {
+ max_height = nil,
+ max_width = nil,
+ border = "single",
+ mappings = {
+ close = { "q", "<Esc>" },
+ },
+ },
+ windows = { indent = 1 },
+ render = {
+ max_type_length = nil,
+ },
+ })
+
+ local dap = require("dap")
+ dap.listeners.after.event_initialized["dapui_config"] = function()
+ dapui.open()
+ end
+ end,
+ keys = {
+ {
+ "<F6>",
+ function()
+ require("dapui").toggle()
+ end,
+ desc = "Toggle debug UI",
+ },
+ {
+ "<Leader>dh",
+ function()
+ require("dap.ui.widgets").hover()
+ end,
+ desc = "Debug hover",
+ },
+ {
+ "<Leader>dp",
+ function()
+ require("dap.ui.widgets").preview()
+ end,
+ desc = "Debug preview",
+ },
},
- {
- "<F9>",
- function()
- local widgets = require("dap.ui.widgets")
- widgets.centered_float(widgets.scopes)
- end,
- desc = "Debug scopes",
+ },
+ {
+ "leoluz/nvim-dap-go",
+ dependencies = { "mfussenegger/nvim-dap" },
+ opts = true,
+ keys = {
+ {
+ "<leader>dt",
+ function()
+ require("dap-go").debug_test()
+ end,
+ desc = "Debug test",
+ },
},
},
}
-