From 02d673d37c6a097a43db877644e20db84f0880b1 Mon Sep 17 00:00:00 2001 From: Fredrik Averpil Date: Sat, 22 Jul 2023 09:13:54 +0200 Subject: [PATCH] feat(lang): add debug adapter plugin for go (#1115) neotest-go does not provide a DAP strategy, and thus you cannot invoke the debugger with require('neotest').run.run({strategy=dap}). There have been efforts to implement this in https://github.com/nvim-neotest/neotest-go/issues/12 but this seems to have stalled. You can find the background to this change discussed here: https://github.com/LazyVim/LazyVim/discussions/1107 --- lua/lazyvim/plugins/extras/lang/go.lua | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lua/lazyvim/plugins/extras/lang/go.lua b/lua/lazyvim/plugins/extras/lang/go.lua index 38aabc90..a78a7434 100644 --- a/lua/lazyvim/plugins/extras/lang/go.lua +++ b/lua/lazyvim/plugins/extras/lang/go.lua @@ -15,6 +15,10 @@ return { opts = { servers = { gopls = { + keys = { + -- Workaround for the lack of a DAP strategy in neotest-go: https://github.com/nvim-neotest/neotest-go/issues/12 + { "td", "lua require('dap-go').debug_test()", desc = "Debug Nearest (Go)" }, + }, settings = { gopls = { gofumpt = true, @@ -103,6 +107,10 @@ return { vim.list_extend(opts.ensure_installed, { "gomodifytags", "impl", "gofumpt", "goimports-reviser", "delve" }) end, }, + { + "leoluz/nvim-dap-go", + config = true, + }, }, }, {