Fix go-dap config to work if any file is open

This commit is contained in:
Marco 2024-02-23 23:13:21 +01:00
parent d5cd4d1a96
commit 345da923da

View File

@ -1,2 +1,14 @@
require('dap-go').setup()
vim.keymap.set('n', '<leader>td', function() require('dap-go').debug_test() end)
local dapgo = require('dap-go')
dapgo.setup()
vim.keymap.set('n', '<leader>td', function() dapgo.debug_test() end)
local dap = require("dap")
-- we replace the configuration that falls out of dap-go with values that work for me
for key, value in pairs(dap.configurations.go) do
if value.name == "Debug" or value.name == "Debug (Arguments)" then
dap.configurations.go[key].mode = "debug"
dap.configurations.go[key].program = "${workspaceFolder}"
end
end