-
Notifications
You must be signed in to change notification settings - Fork 78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Breakpoint does not work if working directory path contains symbolic link #74
Comments
It seems that this is the problem: Maybe consider using real files instead of symlinks? |
jTo be upfront, there is probably a better way of solving this. I have a workaround which is described below. I open my projects in I solved it with overwriting the config which is passed to dap when calling {
"leoluz/nvim-dap-go",
event = "VeryLazy",
ft = "go",
dependencies = { "nvim-dap", "rcarriga/nvim-dap-ui" },
config = function(_, opts)
local dap, dapui = require "dap", require "dapui"
local dapgo = require "dap-go"
dapgo.setup(opts)
dapui.setup()
map("n", "<leader>dgt", function()
local function debug_test(testname, testpath, build_flags, extra_args)
local config = {
type = "go",
name = testname,
request = "launch",
mode = "test",
program = testpath,
args = { "-test.run", "^" .. testname .. "$" },
buildFlags = build_flags,
substitutePath = {
{ from = "/mnt/Data/dev", to = "/home/marc/dev" },
},
}
if not vim.tbl_isempty(extra_args) then
table.move(extra_args, 1, #extra_args, #config.args + 1, config.args)
end
dap.run(config)
end
local dapgots = require "dap-go-ts"
local test = dapgots.closest_test()
if test.name == "" or test.name == nil then
vim.notify "no test found"
return false
end
dapgo.last_testname = test.name
dapgo.last_testpath = test.package
local msg = string.format("starting debug session '%s : %s'...", test.package, test.name)
vim.notify(msg)
local extra_args = {}
debug_test(test.name, test.package, dapgo.test_buildflags, extra_args)
dapui.open()
end, { desc = "Debug go test" })
end,
},
delve or dap (don't know to be honest) provide a way of substituting paths when symlinks are used. https://go.googlesource.com/vscode-go/+/c3516da303907ca11ee51e64f961cf2a4ac5339a/docs/dlv-dap.md |
I found that if current working directory path contains symbolic link, running
require('dap-go').debug_test()
will ignore breakpoint.It is like following:
~/workspace/gotest
ln -s gotest ~/workspace/gotest
cd gotest
Then set arbitrary breakpoint, and run
require('dap-go').debug_test()
.This will not happen by running
require('dap').cotinue()
and select 1 to debugmain.go
, even working directory path contains symbolic link. So I suppose it is caused bydebug_test
function.The text was updated successfully, but these errors were encountered: