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

docs: add vs code debugging section with headless delve #1187

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

imyounas
Copy link

In the current README.md, the debugging section lacks the instructions on how to setup VS Code with delve in headless mode to debug bubble tea apps.
I have added step by step instructions on how to do this, believing it will be a great help for new developers on how to debug CLI apps.
Kindly review & approve it.
Thanks - Imran

@fireflycons
Copy link

Nice, however you may want to adjust this to include how to pass command line arguments to the program being debugged. Took me 15-20 min or so to work this out, not having used dlv in this manner before.

I think specifically point out that args is invalid in launch.json for this remote mode, and that the args need to be passed to dlv directly - that everything after -- is passed to the program being debugged, e.g.

dlv debug --headless --api-version=2 --listen=127.0.0.1:43000 . -- arg1 --arg2 [ etc ]

Copy link
Member

@aymanbagabas aymanbagabas left a comment

Choose a reason for hiding this comment

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

Perhaps in DEBUG.md Wdyt @charmbracelet/everyone?

@raphamorim
Copy link
Member

Perhaps in DEBUG.md Wdyt @charmbracelet/everyone?

I think is better in a DEBUG file, so we can also add more information not only for VS Code users but other editors/stacks

@raphamorim
Copy link
Member

Actually, I wasn't aware we already have a debugging section on README, then I think is ok to go ahead as long we mind if it expand/gets bigger we should dedicate a debug area in the repo

@bashbunni
Copy link
Member

Personally, I think it makes sense to link to their own editor's documentation instead of re-writing it in our own words then having to maintain that copy. We can link to the VS Code documentation on how to connect to a headless delve server https://github.com/golang/vscode-go/blob/master/docs/debugging.md#remote-debugging

I don't have any strong opinions about keeping it in the README vs DEBUG.md file

@@ -283,6 +283,33 @@ for backwards compatibility reasons. However, delve recommends using version 2
for all new development and some clients may no longer work with version 1.
For more information, see the [Delve documentation](https://github.com/go-delve/delve/tree/master/Documentation/api).

### Debugging with Delve using VS Code
Copy link
Member

@bashbunni bashbunni Feb 13, 2025

Choose a reason for hiding this comment

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

Suggested change
### Debugging with Delve using VS Code
#### Connecting to a headless session
You can connect your editor's debugger to a headless delve session. This is known as remote debugging.
- [VSCode - Remote Debugging](https://github.com/golang/vscode-go/blob/master/docs/debugging.md#remote-debugging)

I think we could just do this and remove the other instructions below

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.

5 participants