33 * Licensed under the MIT License. See License.txt in the project root for license information.
44 *--------------------------------------------------------------------------------------------*/
55
6- import { localize } from 'vs/nls' ;
7- import * as lifecycle from 'vs/base/common/lifecycle' ;
86import Messages from 'vs/workbench/parts/markers/common/messages' ;
97import Constants from 'vs/workbench/parts/markers/common/constants' ;
108import { KeyMod , KeyCode } from 'vs/base/common/keyCodes' ;
11- import { IWorkbenchContribution , IWorkbenchContributionsRegistry , Extensions as WorkbenchExtensions } from 'vs/workbench/common/contributions' ;
12- import * as platform from 'vs/platform/platform' ;
13- import { IMarkerService } from 'vs/platform/markers/common/markers' ;
14- import { IActivityBarService , NumberBadge } from 'vs/workbench/services/activity/common/activityBarService' ;
9+ import { Registry } from 'vs/platform/platform' ;
1510import { SyncActionDescriptor } from 'vs/platform/actions/common/actions' ;
1611import { IWorkbenchActionRegistry , Extensions as ActionExtensions } from 'vs/workbench/common/actionRegistry' ;
1712import * as panel from 'vs/workbench/browser/panel' ;
1813import { Extensions , IConfigurationRegistry } from 'vs/platform/configuration/common/configurationRegistry' ;
1914import * as markersPanelActions from 'vs/workbench/parts/markers/browser/markersPanelActions' ;
2015
21- class StatusUpdater implements IWorkbenchContribution {
22- static ID = 'vs.markers.statusUpdater' ;
23-
24- private toDispose : lifecycle . IDisposable [ ] ;
25-
26- constructor (
27- @IMarkerService private markerService : IMarkerService ,
28- @IActivityBarService private activityBarService : IActivityBarService
29- ) {
30-
31- this . toDispose = [ ] ;
32- this . toDispose . push ( markerService . onMarkerChanged ( ( ) => this . updateActivityBadge ( ) ) ) ;
33- }
34-
35- private updateActivityBadge ( ) : void {
36- const stats = this . markerService . getStatistics ( ) ;
37- const problemCount = stats . errors + stats . warnings + stats . infos + stats . unknowns ;
38- if ( problemCount > 0 ) {
39- const badge = new NumberBadge ( problemCount , n => localize ( { comment : [ 'Argument represents count (number) of errors and warnings.' ] , key : 'errorsAndWarnings' } , '{0} Errors and Warnings' , n ) ) ;
40- this . activityBarService . showActivity ( Constants . MARKERS_PANEL_ID , badge ) ;
41- } else {
42- this . activityBarService . showActivity ( Constants . MARKERS_PANEL_ID , null ) ;
43- }
44- }
45-
46- public getId ( ) : string {
47- return StatusUpdater . ID ;
48- }
49-
50- public dispose ( ) : void {
51- this . toDispose = lifecycle . dispose ( this . toDispose ) ;
52- }
53- }
54-
5516export function registerContributions ( ) : void {
5617
57- ( < IConfigurationRegistry > platform . Registry . as ( Extensions . Configuration ) ) . registerConfiguration ( {
18+ // configuration
19+ Registry . as < IConfigurationRegistry > ( Extensions . Configuration ) . registerConfiguration ( {
5820 'id' : 'problems' ,
5921 'order' : 101 ,
6022 'title' : Messages . PROBLEMS_PANEL_CONFIGURATION_TITLE ,
@@ -68,8 +30,8 @@ export function registerContributions(): void {
6830 }
6931 } ) ;
7032
71- // register markers panel
72- ( < panel . PanelRegistry > platform . Registry . as ( panel . Extensions . Panels ) ) . registerPanel ( new panel . PanelDescriptor (
33+ // markers panel
34+ Registry . as < panel . PanelRegistry > ( panel . Extensions . Panels ) . registerPanel ( new panel . PanelDescriptor (
7335 'vs/workbench/parts/markers/browser/markersPanel' ,
7436 'MarkersPanel' ,
7537 Constants . MARKERS_PANEL_ID ,
@@ -79,17 +41,12 @@ export function registerContributions(): void {
7941
8042 ) ) ;
8143
82- let registry = < IWorkbenchActionRegistry > platform . Registry . as ( ActionExtensions . WorkbenchActions ) ;
83-
44+ // actions
45+ const registry = Registry . as < IWorkbenchActionRegistry > ( ActionExtensions . WorkbenchActions ) ;
8446 registry . registerWorkbenchAction ( new SyncActionDescriptor ( markersPanelActions . ToggleMarkersPanelAction , markersPanelActions . ToggleMarkersPanelAction . ID , markersPanelActions . ToggleMarkersPanelAction . LABEL , {
8547 primary : KeyMod . CtrlCmd | KeyMod . Shift | KeyCode . KEY_M
86- } ) , 'View: ' + Messages . MARKERS_PANEL_TOGGLE_LABEL , Messages . MARKERS_PANEL_VIEW_CATEGORY ) ;
48+ } ) , 'View: Show Problems' , Messages . MARKERS_PANEL_VIEW_CATEGORY ) ;
8749
8850 // Retaining old action to show errors and warnings, so that custom bindings to this action for existing users works.
8951 registry . registerWorkbenchAction ( new SyncActionDescriptor ( markersPanelActions . ToggleErrorsAndWarningsAction , markersPanelActions . ToggleErrorsAndWarningsAction . ID , markersPanelActions . ToggleErrorsAndWarningsAction . LABEL ) , '' ) ;
90-
91- // Register StatusUpdater
92- ( < IWorkbenchContributionsRegistry > platform . Registry . as ( WorkbenchExtensions . Workbench ) ) . registerWorkbenchContribution (
93- StatusUpdater
94- ) ;
9552}
0 commit comments