Skip to content
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

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

Merged
merged 1 commit into from
Oct 14, 2024

Conversation

hown3d
Copy link
Contributor

@hown3d hown3d commented Oct 13, 2024

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.

@hown3d hown3d mentioned this pull request Oct 13, 2024
Copy link
Owner

@fredrikaverpil fredrikaverpil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Robust and nice. Thank you! 🚀

@fredrikaverpil fredrikaverpil enabled auto-merge (squash) October 14, 2024 06:44
@fredrikaverpil fredrikaverpil merged commit 8779ea0 into fredrikaverpil:main Oct 14, 2024
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants