@@ -61,11 +61,11 @@ export class DebugService implements IDebugService {
6161 private taskRunner : DebugTaskRunner ;
6262 private configurationManager : ConfigurationManager ;
6363 private toDispose : IDisposable [ ] ;
64- private debugType : IContextKey < string > ;
65- private debugState : IContextKey < string > ;
66- private inDebugMode : IContextKey < boolean > ;
67- private debugUx : IContextKey < string > ;
68- private breakpointsExist : IContextKey < boolean > ;
64+ private debugType ! : IContextKey < string > ;
65+ private debugState ! : IContextKey < string > ;
66+ private inDebugMode ! : IContextKey < boolean > ;
67+ private debugUx ! : IContextKey < string > ;
68+ private breakpointsExist ! : IContextKey < boolean > ;
6969 private breakpointsToSendOnResourceSaved : Set < string > ;
7070 private initializing = false ;
7171 private previousState : State | undefined ;
@@ -80,7 +80,7 @@ export class DebugService implements IDebugService {
8080 @IDialogService private readonly dialogService : IDialogService ,
8181 @IWorkbenchLayoutService private readonly layoutService : IWorkbenchLayoutService ,
8282 @IWorkspaceContextService private readonly contextService : IWorkspaceContextService ,
83- @IContextKeyService contextKeyService : IContextKeyService ,
83+ @IContextKeyService private readonly contextKeyService : IContextKeyService ,
8484 @ILifecycleService private readonly lifecycleService : ILifecycleService ,
8585 @IInstantiationService private readonly instantiationService : IInstantiationService ,
8686 @IExtensionService private readonly extensionService : IExtensionService ,
@@ -101,17 +101,19 @@ export class DebugService implements IDebugService {
101101 this . configurationManager = this . instantiationService . createInstance ( ConfigurationManager ) ;
102102 this . toDispose . push ( this . configurationManager ) ;
103103
104- this . debugType = CONTEXT_DEBUG_TYPE . bindTo ( contextKeyService ) ;
105- this . debugState = CONTEXT_DEBUG_STATE . bindTo ( contextKeyService ) ;
106- this . inDebugMode = CONTEXT_IN_DEBUG_MODE . bindTo ( contextKeyService ) ;
107- this . debugUx = CONTEXT_DEBUG_UX . bindTo ( contextKeyService ) ;
108- this . debugUx . set ( ! ! this . configurationManager . selectedConfiguration . name ? 'default' : 'simple' ) ;
104+ contextKeyService . bufferChangeEvents ( ( ) => {
105+ this . debugType = CONTEXT_DEBUG_TYPE . bindTo ( contextKeyService ) ;
106+ this . debugState = CONTEXT_DEBUG_STATE . bindTo ( contextKeyService ) ;
107+ this . inDebugMode = CONTEXT_IN_DEBUG_MODE . bindTo ( contextKeyService ) ;
108+ this . debugUx = CONTEXT_DEBUG_UX . bindTo ( contextKeyService ) ;
109+ this . debugUx . set ( ! ! this . configurationManager . selectedConfiguration . name ? 'default' : 'simple' ) ;
110+ this . breakpointsExist = CONTEXT_BREAKPOINTS_EXIST . bindTo ( contextKeyService ) ;
111+ } ) ;
109112
110113 this . debugStorage = this . instantiationService . createInstance ( DebugStorage ) ;
111114 this . model = this . instantiationService . createInstance ( DebugModel , this . debugStorage ) ;
112115 this . telemetry = this . instantiationService . createInstance ( DebugTelemetry , this . model ) ;
113116 const setBreakpointsExistContext = ( ) => this . breakpointsExist . set ( ! ! ( this . model . getBreakpoints ( ) . length || this . model . getDataBreakpoints ( ) . length || this . model . getFunctionBreakpoints ( ) . length ) ) ;
114- this . breakpointsExist = CONTEXT_BREAKPOINTS_EXIST . bindTo ( contextKeyService ) ;
115117 setBreakpointsExistContext ( ) ;
116118
117119 this . viewModel = new ViewModel ( contextKeyService ) ;
@@ -229,10 +231,12 @@ export class DebugService implements IDebugService {
229231 private onStateChange ( ) : void {
230232 const state = this . state ;
231233 if ( this . previousState !== state ) {
232- this . debugState . set ( getStateLabel ( state ) ) ;
233- this . inDebugMode . set ( state !== State . Inactive ) ;
234- // Only show the simple ux if debug is not yet started and if no launch.json exists
235- this . debugUx . set ( ( ( state !== State . Inactive && state !== State . Initializing ) || this . configurationManager . selectedConfiguration . name ) ? 'default' : 'simple' ) ;
234+ this . contextKeyService . bufferChangeEvents ( ( ) => {
235+ this . debugState . set ( getStateLabel ( state ) ) ;
236+ this . inDebugMode . set ( state !== State . Inactive ) ;
237+ // Only show the simple ux if debug is not yet started and if no launch.json exists
238+ this . debugUx . set ( ( ( state !== State . Inactive && state !== State . Initializing ) || this . configurationManager . selectedConfiguration . name ) ? 'default' : 'simple' ) ;
239+ } ) ;
236240 this . previousState = state ;
237241 this . _onDidChangeState . fire ( state ) ;
238242 }
0 commit comments