-
Notifications
You must be signed in to change notification settings - Fork 80
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
Set the Delve port dynamically for remote debug #78
Conversation
Hello @leoluz, is it possible to get some feedback please? |
I am not sure that I understand exactly what is your use-case. You don't have to setup a different Delve port per Go project. They can all use the same port configuration unless you are trying to debug different Go projects at the same time. Can you please clarify what your use-case is? |
I work on projects deployed on a local k8s cluster (k3d), most of them have a binary for an HTTP server and others for workers (kafka consumers for example). Also I always have multiple apps running in my cluster, each app is deployed in a development docker image with its own delve port. Each port must be unique to be able to setup port forwarding on my local host. It's really more convenient for me to keep the delve clients configuration inside my projects instead of having to set a long list of config entries in my neovim's config. |
Same here, I am looking forward to such addition. I have a setup that uses telepresence that randomly allocates a different free port so I can use it to debug my application inside a cluster with a very distributed system. |
Do you have any other questions @leoluz? |
@cyb3rd4d Tks for the explanation. I'll try to review your PR soon. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your contribution!
Can you please also update the doc/nvim-dap-go.txt
file?
Oh yes sorry I forgot this one! |
Currently the Delve port can be defined either randomly or hard-coded by hand. Hard-coded port allows to know which port to use in debug configurations, but in practice with many Go projects, it would be great to set the Delve port in debug configurations. Luckily `nvim-dap` allows to set an `on_config` callback for an adapter, which can be used to resolve the adapter settings when a debug session starts. This PR implements this `nvim-dap` feature, which can be used with the support of VSCode `launch.json` files to greatly enhance the developer experience. This potentially resolves leoluz#73
a3cd1ef
to
d43aab3
Compare
I rebased and added config validation + completed the doc. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the update. I added one more comment.
The extension now decides if it should enable the remote debugging if a port is defined in the user configuration.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Thank you for contributing!
Currently the Delve port can be defined either randomly or hard-coded by hand.
Hard-coded port allows to know which port to use in remote debug configurations, but in practice with many Go projects, it would be great to set the Delve port in debug configurations.
Luckily
nvim-dap
allows to set anon_config
callback for an adapter, which can be used to resolve the adapter settings when a debug session starts. This PR implements thisnvim-dap
feature, which can be used with the support of VSCodelaunch.json
files to greatly enhance the developer experience.This potentially resolves #73