@@ -474,6 +474,21 @@ async void DebugService_DebuggerStopped(object sender, DebuggerStopEventArgs e)
474474 // Flush pending output before sending the event
475475 await this . outputDebouncer . Flush ( ) ;
476476
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+
477492 await this . SendEvent (
478493 StoppedEvent . Type ,
479494 new StoppedEventBody
@@ -485,7 +500,7 @@ await this.SendEvent(
485500 Line = e . InvocationInfo . ScriptLineNumber ,
486501 Column = e . InvocationInfo . OffsetInLine ,
487502 ThreadId = 1 , // TODO: Change this based on context
488- Reason = "breakpoint" // TODO: Change this based on context
503+ Reason = debuggerStoppedReason
489504 } ) ;
490505 }
491506
0 commit comments