@@ -29,18 +29,18 @@ export interface IExtensionStatusBarItemService {
29
29
readonly _serviceBrand : undefined ;
30
30
31
31
setOrUpdateEntry ( id : string , statusId : string , extensionId : string | undefined , name : string , text : string , tooltip : IMarkdownString | string | undefined , command : Command | undefined , color : string | ThemeColor | undefined , backgroundColor : string | ThemeColor | undefined , alignLeft : boolean , priority : number | undefined , accessibilityInformation : IAccessibilityInformation | undefined ) : IDisposable ;
32
+
33
+ hasEntry ( id : string ) : boolean ;
32
34
}
33
35
34
36
35
37
class ExtensionStatusBarItemService implements IExtensionStatusBarItemService {
36
38
37
39
declare readonly _serviceBrand : undefined ;
38
40
39
- private readonly entries : Map < string , { accessor : IStatusbarEntryAccessor ; alignment : MainThreadStatusBarAlignment ; priority : number } > = new Map ( ) ;
41
+ private readonly _entries : Map < string , { accessor : IStatusbarEntryAccessor ; alignment : MainThreadStatusBarAlignment ; priority : number } > = new Map ( ) ;
40
42
41
- constructor (
42
- @IStatusbarService private readonly _statusbarService : IStatusbarService
43
- ) { }
43
+ constructor ( @IStatusbarService private readonly _statusbarService : IStatusbarService ) { }
44
44
45
45
setOrUpdateEntry ( entryId : string , id : string , extensionId : string | undefined , name : string , text : string , tooltip : IMarkdownString | string | undefined , command : Command | undefined , color : string | ThemeColor | undefined , backgroundColor : string | ThemeColor | undefined , alignLeft : boolean , priority : number | undefined , accessibilityInformation : IAccessibilityInformation | undefined ) : IDisposable {
46
46
// if there are icons in the text use the tooltip for the aria label
@@ -65,7 +65,7 @@ class ExtensionStatusBarItemService implements IExtensionStatusBarItemService {
65
65
let alignment = alignLeft ? StatusbarAlignment . LEFT : StatusbarAlignment . RIGHT ;
66
66
67
67
// alignment and priority can only be set once (at creation time)
68
- const existingEntry = this . entries . get ( entryId ) ;
68
+ const existingEntry = this . _entries . get ( entryId ) ;
69
69
if ( existingEntry ) {
70
70
alignment = existingEntry . alignment ;
71
71
priority = existingEntry . priority ;
@@ -85,7 +85,7 @@ class ExtensionStatusBarItemService implements IExtensionStatusBarItemService {
85
85
entryPriority = priority ;
86
86
}
87
87
88
- this . entries . set ( entryId , {
88
+ this . _entries . set ( entryId , {
89
89
accessor : this . _statusbarService . addEntry ( entry , id , alignment , entryPriority ) ,
90
90
alignment,
91
91
priority
@@ -97,13 +97,17 @@ class ExtensionStatusBarItemService implements IExtensionStatusBarItemService {
97
97
}
98
98
99
99
return toDisposable ( ( ) => {
100
- const entry = this . entries . get ( entryId ) ;
100
+ const entry = this . _entries . get ( entryId ) ;
101
101
if ( entry ) {
102
102
entry . accessor . dispose ( ) ;
103
- this . entries . delete ( entryId ) ;
103
+ this . _entries . delete ( entryId ) ;
104
104
}
105
105
} ) ;
106
106
}
107
+
108
+ hasEntry ( id : string ) : boolean {
109
+ return this . _entries . has ( id ) ;
110
+ }
107
111
}
108
112
109
113
registerSingleton ( IExtensionStatusBarItemService , ExtensionStatusBarItemService , InstantiationType . Delayed ) ;
0 commit comments