From 88e9561ca0995dfd5284cdc30f0d8e3f922ea364 Mon Sep 17 00:00:00 2001 From: Fredrik Averpil Date: Thu, 13 Jul 2023 14:26:42 +0200 Subject: [PATCH] feat(lang): add debug adapter plugin for go 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 0d7f5071..8102d74b 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 { table.insert(opts.ensure_installed, "delve") end, }, + { + "leoluz/nvim-dap-go", + config = true, + }, }, }, {