@@ -474,6 +474,21 @@ async void DebugService_DebuggerStopped(object sender, DebuggerStopEventArgs e)
474
474
// Flush pending output before sending the event
475
475
await this . outputDebouncer . Flush ( ) ;
476
476
477
+ // Provide the reason for why the debugger has stopped script execution.
478
+ // See https://github.com/Microsoft/vscode/issues/3648
479
+ // The reason is displayed in the breakpoints viewlet. Some recommended reasons are:
480
+ // "step", "breakpoint", "function breakpoint", "exception" and "pause".
481
+ // We don't support exception breakpoints and for "pause", we can't distinguish
482
+ // between stepping and the user pressing the pause/break button in the debug toolbar.
483
+ string debuggerStoppedReason = "step" ;
484
+ if ( e . Breakpoints . Count > 0 )
485
+ {
486
+ debuggerStoppedReason =
487
+ e . Breakpoints [ 0 ] is CommandBreakpoint
488
+ ? "function breakpoint"
489
+ : "breakpoint" ;
490
+ }
491
+
477
492
await this . SendEvent (
478
493
StoppedEvent . Type ,
479
494
new StoppedEventBody
@@ -485,7 +500,7 @@ await this.SendEvent(
485
500
Line = e . InvocationInfo . ScriptLineNumber ,
486
501
Column = e . InvocationInfo . OffsetInLine ,
487
502
ThreadId = 1 , // TODO: Change this based on context
488
- Reason = "breakpoint" // TODO: Change this based on context
503
+ Reason = debuggerStoppedReason
489
504
} ) ;
490
505
}
491
506
0 commit comments