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

feat: set cwd for dlv based on program #99

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

mcoqzeug
Copy link

@mcoqzeug mcoqzeug commented Sep 22, 2024

This potentially resolves #85.

  • Similar to vscode-go, set dlv.executable.cwd based on the value of debug_config.program. If program is a directory, set cwd to program. If program is a path to a go file, set cwd to its parent directory.
  • Convert program to absolute path.

We probably don't need config.delve.cwd anymore.

Reference: https://github.com/golang/vscode-go/blob/master/extension/src/goDebugConfiguration.ts#L545

This potentially resolves leoluz#85.

vscode-go sets dlv cwd based on the value of program.

Reference: https://github.com/golang/vscode-go/blob/master/extension/src/goDebugConfiguration.ts#L545
lua/dap-go.lua Outdated Show resolved Hide resolved
Copy link
Owner

@leoluz leoluz left a comment

Choose a reason for hiding this comment

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

@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_parent function for example can be replaced by fnamemodify (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)

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.

Allow debugging applications and tests in monorepos
2 participants