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

Allow debugging applications and tests in monorepos #85

Open
leoluz opened this issue May 2, 2024 · 1 comment · May be fixed by #99
Open

Allow debugging applications and tests in monorepos #85

leoluz opened this issue May 2, 2024 · 1 comment · May be fixed by #99
Labels
wontfix This will not be worked on

Comments

@leoluz
Copy link
Owner

leoluz commented May 2, 2024

As explained in this issue it wasn't possible to launch the debugee (go application or test to be debugged) in projects where the go.mod is not in the cwd when delve is launched.

#81 introduced a new attribute (cwd) in the dap.adaptars.go.executable table to allow defining this value. However it partially fixes the problem as users would have to hardcode the value with the path to where the go.mod file is located. This isn't ideal as switching projects would require users to modify this attribute to set the new path.

This proposal suggests:

  • Investigate a strategy to find the path of the closer go.mod file in parent directories based on the path of the current buffer and dynamically set the dap.adaptars.go.executable.cwd with it. See similar strategy here.
  • Provide proper documentation instructing users about when and how to use this feature.
@leoluz leoluz mentioned this issue May 2, 2024
mcoqzeug added a commit to mcoqzeug/nvim-dap-go that referenced this issue Sep 22, 2024
@mcoqzeug mcoqzeug linked a pull request Sep 22, 2024 that will close this issue
mcoqzeug added a commit to mcoqzeug/nvim-dap-go that referenced this issue Sep 22, 2024
serpro69 added a commit to serpro69/nvim-config that referenced this issue Sep 26, 2024
Tried to setup DAP for go following nvim-dap documentation and using
delve directly, as described in https://github.com/mfussenegger/nvim-dap/wiki/Debug-Adapter-installation#go-using-delve-directly

However, I was struggling to get DAP working and was getting "Error on launch: Failed to launch" errors all the time,
when I discovered (via dap-ui) that the defaults of nvim-dap-go expects go.mod to be in the root of the project.

At the same time, the "native" neotest adapter for go seems to have the same behavior and
does not seem to support projects where go.mod is not in the root.

This was originally described here
leoluz/nvim-dap-go#80 (comment),
and there's an open issue for this in nvim-dap-go: leoluz/nvim-dap-go#85

There is, however, another adapter for go - fredrikaverpil/neotest-golang - which seems to be more flexible and does support projects
where go.mod is not in the root.

After replacing the adapter and adding configurations as per https://github.com/fredrikaverpil/neotest-golang/?tab=readme-ov-file#example-configuration-debugging,
I was finally able to get DAP working for go.
mcoqzeug added a commit to mcoqzeug/nvim-dap-go that referenced this issue Oct 4, 2024
Copy link

stale bot commented Nov 4, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix This will not be worked on label Nov 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant