feat: set cwd for dlv based on program #99
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
NeonXP/nvim-dap-go!99
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "mcoqzeug/set-cwd-for-dlv"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This potentially resolves #85.
dlv.executable.cwdbased on the value ofdebug_config.program. Ifprogramis a directory, setcwdtoprogram. Ifprogramis a path to a go file, setcwdto its parent directory.programto absolute path.We probably don't need
config.delve.cwdanymore.Reference: https://github.com/golang/vscode-go/blob/master/extension/src/goDebugConfiguration.ts#L545
@ -81,6 +81,24 @@ local function setup_delve_adapter(dap, config)}This would introduce an external dependency to
plenary. I prefer to keep the dependencies in this plugin as small as possible.@ -81,6 +81,24 @@ local function setup_delve_adapter(dap, config)}Hi @leoluz, thanks for the feedback. I've replaced
plenary.pathwithvim.loopfunctions.@ -81,6 +81,24 @@ local function setup_delve_adapter(dap, config)}Thank you
@mcoqzeug Thank you for removing plenary dependency.
I noticed that you are re-implementing file path logic that is already available as vim functions. The
get_parentfunction for example can be replaced byfnamemodify(see https://stackoverflow.com/questions/16485748/how-to-get-the-parent-directory-of-a-path-string). Similar strategy can be used to extract the file extension with filename-modifier:e(see https://vimhelp.org/cmdline.txt.html#filename-modifiers)Thank you, I'm just using this branch, and it works. Hope this will merge soon.
Hi @mcoqzeug .
Thank you for the latest changes and fixes. PR is looking much cleaner now.
To proceed with the merge, the PR would need to include documentation updates in the
README.mdas well as in thedoc/[nvim-dap-go.txtfilesThanks again!
why not merge this? then update docs?
Hi @leoluz, I think this PR only changes a small implementation detail and is compatible with existing documentation. The only change I can think of is to remove the
cwdoption fromREAME.md: https://github.com/leoluz/nvim-dap-go/blob/main/README.md?plain=1#L90-L92. What do you think?@ -81,6 +81,24 @@ local function setup_delve_adapter(dap, config)}Hi, @mcoqzeug I'm facing the same issue and your fork almost solved it for me, so thank you so much for this. I did notice that on my machine,
:lua print(vim.fn.fnamemodify("/a/b/c/main.go", ":e"))returns"go"rather than".go", so deleting the.in this line was the final step to get it working for me.Wondering if it's the same on your side?
Thanks again for your efforts and hope this PR gets merged soon!
Also created https://github.com/leoluz/nvim-dap-go/pull/121 to fix this issue, unfortunately I've only noticed this PR afterwards.
@leoluz does only missing documentation blocks us from merging it?
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.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.