Closed AnthonyMBonafide closed 2 months ago
@AnthonyMBonafide maybe check out this vid if it provides any help: https://www.youtube.com/watch?v=lyNfnI-B640 simple neovim debugging setup (in 10 minutes)
@AnthonyMBonafide maybe check out this vid if it provides any help: https://www.youtube.com/watch?v=lyNfnI-B640 simple neovim debugging setup (in 10 minutes)
@dam9000 , Thank you. I saw this earlier and am still a little lost. Is there some more information on how to get the Debug test
configuration working. He said in the video he wasn't going to go into setting up for that in particular :( . Can you point to some other resource that might help with setting up DAP in more depth?
@AnthonyMBonafide sorry, I don't know. Maybe try asking here: https://github.com/leoluz/nvim-dap-go
@dam9000, I see it listed in the README on how to run them. Could you point me in the right direction of how you would suggest to add this as a key map for Go projects? My thinking at this point is to have a keymap to basically execute :lua require('dap-go').debug_test()
. Maybe slightly better would be to have the Debug test
option execute that command. Not really sure. Any suggestions?
So you want to translate this vimscript to lua:
nmap <silent> <leader>td :lua require('dap-go').debug_test()<CR>
lua:
vim.keymap.set('n', '<leader>td', function()
require('dap-go').debug_test()
end, { silent = true, desc = 'Debug Test' })
@dam9000 , yes thank you. Also, how to I configure this just for Go as other languages cannot leverage that? Should I set up that mapping on attach for dap-go
? IDK if that even makes sense or how to do that correctly. I'll look into the docs and if I figure it out I will create a PR.
You can extract nvim-dap-go
out of the dependency list of nvim-dap
and set nvim-dap-go
to load only on ft = 'go'
. Then you can set your keymaps in the config function of nvim-dap-go
, which will bind the keymap only on plugin load (when you open a file whose filetype is go).
if I figure it out I will create a PR.
I think that nvim-dap-go exists here only to be as an example of how to add language specific debuggers, so providing all of the keybindings may not be a goal
Please seek further assistance at the specific dap adapter's repository.
Describe the bug
Using Kickstart with a couple of additional plugins unrelated to debugging. I am able to start debugging Go projects using the
Debug
,Debug (Arguments)
,Debug test (go.mod)
. However, when I try to use theDebug test
option I get an error that statesError on launch: Failed to launch
. I have set my cursor inside a test function and also tried putting it on the test function signature, but that did not change the results.To Reproduce
F5
)Debug test
optionDesktop
Neovim Version
NVIM v0.9.5
Build type: Release
LuaJIT 2.1.1713773202
Note
I am still rather new to NeoVim and might be doing something silly and apologize in advance if this is a me problem.