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

Make Source field in Breakpoint events optional #67

Merged
merged 2 commits into from Dec 6, 2022

Conversation

corneliusweig
Copy link
Collaborator

Currently, an empty breakpoint contains a "source" field with an empty object:

data, _ := json.Marshal(dap.Breakpoint{})
fmt.Println(string(data))

// {"verified":false,"source":{}}
//                     ^^^^^^^^

This means that BreakpointEvent types with missing source are serialised with an empty source object, which clears the breakpoint location in the UI.

This change makes the "source" field optional, so that an empty breakpoint serialises as:

data, _ := json.Marshal(dap.Breakpoint{})
fmt.Println(string(data))

// {"verified":false}

Fixes #66

@suzmue
Copy link
Collaborator

suzmue commented Dec 1, 2022

Thanks for reporting and fixing this bug!

cmd/gentypes/gentypes.go is used to generate schematypes.go so that will need to be updated as well.

This updates the gentypes to make the Source field of Breakpoint
a pointer in the generated Go types.

For google#66
@suzmue suzmue requested review from suzmue and hyangah December 6, 2022 17:28
@suzmue suzmue marked this pull request as ready for review December 6, 2022 17:28
@suzmue
Copy link
Collaborator

suzmue commented Dec 6, 2022

Hi @corneliusweig! Just marked this as ready for review so that we can get this change in.

Copy link
Collaborator

@hyangah hyangah left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks!

@suzmue suzmue merged commit c3d6893 into google:main Dec 6, 2022
@corneliusweig
Copy link
Collaborator Author

Thank you @suzmue for adding the missing bits!

@corneliusweig corneliusweig deleted the issue-66 branch December 20, 2022 21:27
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.

Type Breakpoint contains empty source
3 participants