fredrikaverpil / neotest-golang

Reliable Neotest adapter for running Go tests in Neovim.
MIT License
141 stars 17 forks source link

fix(dap): use test filepath from neotest positions #202

Closed hown3d closed 1 month ago

hown3d commented 1 month ago

Why is this PR needed

Currently when trying to debug tests via the Neotest Summary panel, the generated dap_configuration is not correct.

The variable fileDirname is expanded in nvim-dap as vim.fn.expand("%:p:h") See https://github.com/mfussenegger/nvim-dap/blob/7ff6936010b7222fea2caea0f67ed77f1b7c60dd/lua/dap.lua#L338-L340

When the focus is on the summary panel, this returns the current working directory.

Since we already know the exact path to the testfile by neotests positions, there's no need to rely on the information about the current window returned by vim.fn.expand function present in the dap client.