Open ccbhj opened 1 year ago
What debug command and argument you were using when you trying to debug the target?
Do you have a minium setup so I can reproduce the issue?
I do not think it related to go.nvim
setup. It may be related to how you are running debug.
You are right. It was my launch.json's fault. After setting up my launch.json correctly, I can start the debugger and see the prompt to chose the configuration. However, I can still see the message Unable to find any nodes at pos. 16:2
, and then the prompter. Not sure whether this is related to go.nvim
Here is the my minium go.nvim setup file
require('go').setup({
goimport='gopls', -- goimport command, can be gopls[default] or goimport
gofmt = 'gopls', --gofmt cmd,
max_line_len = 120, -- max line length in goline format
icons = {breakpoint = '', currentpos = '🏃'},
verbose = true, -- output loginf in messages
lsp_cfg = {
capabilities = require('cmp_nvim_lsp').default_capabilities(),
handlers = handlers,
settings = {
gopls = {
directoryFilters = {
"-**/vendor/git.garena.com/shopee/pl/public/protobuf/go",
"-/vendor/git.garena.com/shopee/pl/public/protobuf/go",
},
-- see https://github.com/golang/tools/blob/master/gopls/doc/analyzers.md
analyses = {
shadow = false,
}
}
}
}, -- true: apply go.nvim non-default gopls setup, if it is a list, will merge with gopls setup e.g.
-- lsp_cfg = {settings={gopls={matcher='CaseInsensitive', ['local'] = 'your_local_module_path', gofumpt = true }}}
lsp_on_attach = on_attach, -- if a on_attach function provided: attach on_attach function to gopls
dap_debug = true, -- set to false to disable dap
--float term recommand if you use richgo/ginkgo with terminal color
dap_debug_keymap = true, -- set keymaps for debugger
dap_debug_gui = true, -- set to tru to enable dap gui, highly recommand
dap_debug_vt = true, -- set to true to enable dap virtual text
dap_retries = 20,
dap_timeout = 15, -- see dap option initialize_timeout_sec = 15,
dap_port = -1,
})
My mini project: test_debugger.zip
Well, I think the debug info should not appear here.
I pushed an update to fix those. Would you check if latest version works for you?
Also in your launch.json. change the request
to launch
may make it easy for debug. (unless you mean attach to running proccess.
{
"configurations": [
{
"args": [],
"buildFlags": "",
"cwd": "${workspaceFolder}",
"env": {},
"envFile": "${workspaceFolder}/.env",
"host": "127.0.0.1",
"mode": "debug",
"name": "Attach main",
"port": 38697,
"processId": 99038,
"program": "${workspaceFolder}/main.go",
"remotePath": "",
"request": "launch",
"type": "go"
},
{
"mode": "local",
"name": "Attach to Process",
"processId": 99038,
"request": "attach",
"type": "go"
}
],
"version": "0.2.0"
}
Thanks!
@ccbhj Can you check if the latest version works for you?
After editing the launch.json with command
GoDbgConfig
and save it without changing anything, then I useGoDebug
and it didnot show the prompt but the error message as followWhat I expect: see the prompt so that I can choose the debug config from the launch.json
My nvim version: NVIM v0.8.0
My go.nvim version commit: 8f4386a683b7546a3c0de19c4a11ed84518258cb
My go.nvim config
Looking forward to your help, thank you ~