google / go-dap

Go implementation of the Debug Adapter Protocol
Apache License 2.0
127 stars 22 forks source link

Make `Source` field in `Breakpoint` events optional #67

Closed corneliusweig closed 1 year ago

corneliusweig commented 1 year ago

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 commented 1 year ago

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.

suzmue commented 1 year ago

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

corneliusweig commented 1 year ago

Thank you @suzmue for adding the missing bits!