1local dap = require("dap")
2local key = require("gabrielgio.key")
3local dapgo = require("dap-go")
4
5dapgo.setup({delve = {build_flags = "-tags=unit,integration,e2e"}})
6
7key.nnoremap("<F5>", ":lua require'dap'.continue()<CR>")
8key.nnoremap("<F10>", ":lua require'dap'.step_over()<CR>")
9key.nnoremap("<F11>", ":lua require'dap'.step_into()<CR>")
10key.nnoremap("<F12>", ":lua require'dap'.step_out()<CR>")
11key.nnoremap("<leader>b", ":lua require'dap'.toggle_breakpoint()<CR>")
12key.nnoremap("<leader>B", ":lua require'dap'.set_breakpoint(vim.fn.input('Condition: '))<CR>")
13key.nnoremap("<leader>dt", ":lua require'dap-go'.debug_test()<CR>")
14key.nnoremap("<leader>dr", ":lua require'dap'.repl.open()<CR>")
15
16dap.adapters.gdb = {
17 type = "executable",
18 command = "gdb",
19 args = { "-i", "dap" }
20}
21
22dap.configurations.c = {
23 {
24 name = "Launch",
25 type = "gdb",
26 request = "launch",
27 program = function()
28 return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file')
29 end,
30 cwd = "${workspaceFolder}",
31 },
32}