@@ -22,7 +22,6 @@ export class MainThreadDebugService implements MainThreadDebugServiceShape, IDeb
2222
2323 private readonly _proxy : ExtHostDebugServiceShape ;
2424 private readonly _toDispose = new DisposableStore ( ) ;
25- private _breakpointEventsActive : boolean | undefined ;
2625 private readonly _debugAdapters : Map < number , ExtensionHostDebugAdapter > ;
2726 private _debugAdaptersHandleCounter = 1 ;
2827 private readonly _debugConfigurationProviders : Map < number , IDebugConfigurationProvider > ;
@@ -79,6 +78,40 @@ export class MainThreadDebugService implements MainThreadDebugServiceShape, IDeb
7978 this . _proxy . $acceptStackFrameFocus ( dto ) ;
8079 }
8180 } ) ) ;
81+ this . sendBreakpointsAndListen ( ) ;
82+ }
83+
84+ private sendBreakpointsAndListen ( ) : void {
85+ // set up a handler to send more
86+ this . _toDispose . add ( this . debugService . getModel ( ) . onDidChangeBreakpoints ( e => {
87+ // Ignore session only breakpoint events since they should only reflect in the UI
88+ if ( e && ! e . sessionOnly ) {
89+ const delta : IBreakpointsDeltaDto = { } ;
90+ if ( e . added ) {
91+ delta . added = this . convertToDto ( e . added ) ;
92+ }
93+ if ( e . removed ) {
94+ delta . removed = e . removed . map ( x => x . getId ( ) ) ;
95+ }
96+ if ( e . changed ) {
97+ delta . changed = this . convertToDto ( e . changed ) ;
98+ }
99+
100+ if ( delta . added || delta . removed || delta . changed ) {
101+ this . _proxy . $acceptBreakpointsDelta ( delta ) ;
102+ }
103+ }
104+ } ) ) ;
105+
106+ // send all breakpoints
107+ const bps = this . debugService . getModel ( ) . getBreakpoints ( ) ;
108+ const fbps = this . debugService . getModel ( ) . getFunctionBreakpoints ( ) ;
109+ const dbps = this . debugService . getModel ( ) . getDataBreakpoints ( ) ;
110+ if ( bps . length > 0 || fbps . length > 0 ) {
111+ this . _proxy . $acceptBreakpointsDelta ( {
112+ added : this . convertToDto ( bps ) . concat ( this . convertToDto ( fbps ) ) . concat ( this . convertToDto ( dbps ) )
113+ } ) ;
114+ }
82115 }
83116
84117 public dispose ( ) : void {
@@ -108,44 +141,6 @@ export class MainThreadDebugService implements MainThreadDebugServiceShape, IDeb
108141 this . _toDispose . add ( this . debugService . getAdapterManager ( ) . registerDebugAdapterFactory ( debugTypes , this ) ) ;
109142 }
110143
111- public $startBreakpointEvents ( ) : void {
112-
113- if ( ! this . _breakpointEventsActive ) {
114- this . _breakpointEventsActive = true ;
115-
116- // set up a handler to send more
117- this . _toDispose . add ( this . debugService . getModel ( ) . onDidChangeBreakpoints ( e => {
118- // Ignore session only breakpoint events since they should only reflect in the UI
119- if ( e && ! e . sessionOnly ) {
120- const delta : IBreakpointsDeltaDto = { } ;
121- if ( e . added ) {
122- delta . added = this . convertToDto ( e . added ) ;
123- }
124- if ( e . removed ) {
125- delta . removed = e . removed . map ( x => x . getId ( ) ) ;
126- }
127- if ( e . changed ) {
128- delta . changed = this . convertToDto ( e . changed ) ;
129- }
130-
131- if ( delta . added || delta . removed || delta . changed ) {
132- this . _proxy . $acceptBreakpointsDelta ( delta ) ;
133- }
134- }
135- } ) ) ;
136-
137- // send all breakpoints
138- const bps = this . debugService . getModel ( ) . getBreakpoints ( ) ;
139- const fbps = this . debugService . getModel ( ) . getFunctionBreakpoints ( ) ;
140- const dbps = this . debugService . getModel ( ) . getDataBreakpoints ( ) ;
141- if ( bps . length > 0 || fbps . length > 0 ) {
142- this . _proxy . $acceptBreakpointsDelta ( {
143- added : this . convertToDto ( bps ) . concat ( this . convertToDto ( fbps ) ) . concat ( this . convertToDto ( dbps ) )
144- } ) ;
145- }
146- }
147- }
148-
149144 public $registerBreakpoints ( DTOs : Array < ISourceMultiBreakpointDto | IFunctionBreakpointDto | IDataBreakpointDto > ) : Promise < void > {
150145
151146 for ( const dto of DTOs ) {
0 commit comments