66import 'vs/css!../browser/media/debug.contribution' ;
77import 'vs/css!../browser/media/debugHover' ;
88import nls = require( 'vs/nls' ) ;
9- import { CommonEditorRegistry , ContextKey , EditorActionDescriptor } from 'vs/editor /common/editorCommonExtensions' ;
9+ import lifecycle = require ( 'vs/base /common/lifecycle' ) ;
1010import { KeyMod , KeyCode } from 'vs/base/common/keyCodes' ;
11+ import { CommonEditorRegistry , ContextKey , EditorActionDescriptor } from 'vs/editor/common/editorCommonExtensions' ;
1112import { SyncActionDescriptor } from 'vs/platform/actions/common/actions' ;
1213import platform = require( 'vs/platform/platform' ) ;
1314import { registerSingleton } from 'vs/platform/instantiation/common/extensions' ;
@@ -25,6 +26,7 @@ import debugwidget = require('vs/workbench/parts/debug/browser/debugActionsWidge
2526import service = require( 'vs/workbench/parts/debug/electron-browser/debugService' ) ;
2627import { DebugEditorContribution } from 'vs/workbench/parts/debug/browser/debugEditorContribution' ;
2728import { IViewletService } from 'vs/workbench/services/viewlet/common/viewletService' ;
29+ import { IActivityService , IconBadge , NumberBadge , ProgressBadge } from 'vs/workbench/services/activity/common/activityService' ;
2830import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService' ;
2931
3032import IDebugService = debug . IDebugService ;
@@ -43,6 +45,41 @@ class OpenDebugViewletAction extends viewlet.ToggleViewletAction {
4345 }
4446}
4547
48+ class StatusUpdater implements wbext . IWorkbenchContribution {
49+ static ID = 'Monaco.IDE.UI.Viewlets.DebugViewlet.Workbench.StatusUpdater' ;
50+
51+ private toDispose : lifecycle . IDisposable [ ] ;
52+ private pausedBadge : ProgressBadge ;
53+ private runningBadge : IconBadge ;
54+
55+ constructor (
56+ @IActivityService private activityService : IActivityService ,
57+ @IDebugService private debugService : IDebugService
58+ ) {
59+ this . pausedBadge = new IconBadge ( ( ) => { return nls . localize ( 'debugPaused' , "Paused" ) ; } ) ;
60+ this . runningBadge = new ProgressBadge ( ( ) => { return nls . localize ( 'debugRunning' , "Running" ) ; } ) ;
61+ this . toDispose = [ this . debugService . addListener2 ( debug . ServiceEvents . STATE_CHANGED , ( ) => this . onDebugServiceStateChange ( ) ) ] ;
62+ }
63+
64+ private onDebugServiceStateChange ( ) : void {
65+ if ( this . debugService . getState ( ) === debug . State . Stopped ) {
66+ this . activityService . showActivity ( debug . VIEWLET_ID , this . pausedBadge , 'debug-viewlet-paused-label' ) ;
67+ } else if ( this . debugService . getState ( ) === debug . State . Running ) {
68+ this . activityService . showActivity ( debug . VIEWLET_ID , this . runningBadge , 'debug-viewlet-running-label' ) ;
69+ } else {
70+ this . activityService . clearActivity ( debug . VIEWLET_ID ) ;
71+ }
72+ }
73+
74+ public getId ( ) : string {
75+ return StatusUpdater . ID ;
76+ }
77+
78+ public dispose ( ) : void {
79+ this . toDispose = lifecycle . disposeAll ( this . toDispose ) ;
80+ }
81+ }
82+
4683EditorBrowserRegistry . registerEditorContribution ( DebugEditorContribution ) ;
4784CommonEditorRegistry . registerEditorAction ( new EditorActionDescriptor ( dbgactions . ToggleBreakpointAction , dbgactions . ToggleBreakpointAction . ID , nls . localize ( 'toggleBreakpointAction' , "Debug: Toggle Breakpoint" ) , {
4885 context : ContextKey . EditorTextFocus ,
@@ -100,3 +137,8 @@ registry.registerWorkbenchAction(new SyncActionDescriptor(dbgactions.AddFunction
100137
101138// register service
102139registerSingleton ( IDebugService , service . DebugService ) ;
140+
141+ // Register StatusUpdater
142+ ( < wbext . IWorkbenchContributionsRegistry > platform . Registry . as ( wbext . Extensions . Workbench ) ) . registerWorkbenchContribution (
143+ StatusUpdater
144+ ) ;
0 commit comments