@@ -1510,24 +1510,37 @@ func (s *Server) onAttachRequest(request *dap.AttachRequest) {
1510
1510
// onNextRequest handles 'next' request.
1511
1511
// This is a mandatory request to support.
1512
1512
func (s * Server ) onNextRequest (request * dap.NextRequest , asyncSetupDone chan struct {}) {
1513
- s .send ( & dap.NextResponse {Response : * newResponse (request .Request )})
1513
+ s .sendStepResponse ( request . Arguments . ThreadId , & dap.NextResponse {Response : * newResponse (request .Request )})
1514
1514
s .doStepCommand (api .Next , request .Arguments .ThreadId , asyncSetupDone )
1515
1515
}
1516
1516
1517
1517
// onStepInRequest handles 'stepIn' request
1518
1518
// This is a mandatory request to support.
1519
1519
func (s * Server ) onStepInRequest (request * dap.StepInRequest , asyncSetupDone chan struct {}) {
1520
- s .send ( & dap.StepInResponse {Response : * newResponse (request .Request )})
1520
+ s .sendStepResponse ( request . Arguments . ThreadId , & dap.StepInResponse {Response : * newResponse (request .Request )})
1521
1521
s .doStepCommand (api .Step , request .Arguments .ThreadId , asyncSetupDone )
1522
1522
}
1523
1523
1524
1524
// onStepOutRequest handles 'stepOut' request
1525
1525
// This is a mandatory request to support.
1526
1526
func (s * Server ) onStepOutRequest (request * dap.StepOutRequest , asyncSetupDone chan struct {}) {
1527
- s .send ( & dap.StepOutResponse {Response : * newResponse (request .Request )})
1527
+ s .sendStepResponse ( request . Arguments . ThreadId , & dap.StepOutResponse {Response : * newResponse (request .Request )})
1528
1528
s .doStepCommand (api .StepOut , request .Arguments .ThreadId , asyncSetupDone )
1529
1529
}
1530
1530
1531
+ func (s * Server ) sendStepResponse (threadId int , message dap.Message ) {
1532
+ // All of the threads will be continued by this request, so we need to send
1533
+ // a continued event so the UI can properly reflect the current state.
1534
+ s .send (& dap.ContinuedEvent {
1535
+ Event : * newEvent ("continued" ),
1536
+ Body : dap.ContinuedEventBody {
1537
+ ThreadId : threadId ,
1538
+ AllThreadsContinued : true ,
1539
+ },
1540
+ })
1541
+ s .send (message )
1542
+ }
1543
+
1531
1544
func stoppedGoroutineID (state * api.DebuggerState ) (id int ) {
1532
1545
if state .SelectedGoroutine != nil {
1533
1546
id = state .SelectedGoroutine .ID
@@ -1544,15 +1557,6 @@ func stoppedGoroutineID(state *api.DebuggerState) (id int) {
1544
1557
// due to an error, so the server is ready to receive new requests.
1545
1558
func (s * Server ) doStepCommand (command string , threadId int , asyncSetupDone chan struct {}) {
1546
1559
defer s .asyncCommandDone (asyncSetupDone )
1547
- // All of the threads will be continued by this request, so we need to send
1548
- // a continued event so the UI can properly reflect the current state.
1549
- s .send (& dap.ContinuedEvent {
1550
- Event : * newEvent ("continued" ),
1551
- Body : dap.ContinuedEventBody {
1552
- ThreadId : threadId ,
1553
- AllThreadsContinued : true ,
1554
- },
1555
- })
1556
1560
_ , err := s .debugger .Command (& api.DebuggerCommand {Name : api .SwitchGoroutine , GoroutineID : threadId }, nil )
1557
1561
if err != nil {
1558
1562
s .log .Errorf ("Error switching goroutines while stepping: %v" , err )
0 commit comments