@@ -13,7 +13,7 @@ import { IKeybindingService } from '../../../../platform/keybinding/common/keybi
13
13
import { IProductService } from '../../../../platform/product/common/productService.js' ;
14
14
import { IWorkbenchContribution } from '../../../common/contributions.js' ;
15
15
import { IWorkbenchAssignmentService } from '../../../services/assignment/common/assignmentService.js' ;
16
- import { IStatusbarEntry , IStatusbarEntryAccessor , IStatusbarService , StatusbarAlignment , TooltipContent } from '../../../services/statusbar/browser/statusbar.js' ;
16
+ import { IStatusbarEntry , IStatusbarEntryAccessor , IStatusbarService , ShowTooltipCommand , StatusbarAlignment , TooltipContent } from '../../../services/statusbar/browser/statusbar.js' ;
17
17
import { ChatContextKeys } from '../common/chatContextKeys.js' ;
18
18
import { IChatQuotasService } from '../common/chatQuotasService.js' ;
19
19
import { quotaToButtonMessage , OPEN_CHAT_QUOTA_EXCEEDED_DIALOG , CHAT_SETUP_ACTION_LABEL , TOGGLE_CHAT_ACTION_ID , CHAT_OPEN_ACTION_ID } from './actions/chatActions.js' ;
@@ -24,6 +24,8 @@ import { KeybindingLabel } from '../../../../base/browser/ui/keybindingLabel/key
24
24
import { defaultCheckboxStyles , defaultKeybindingLabelStyles } from '../../../../platform/theme/browser/defaultStyles.js' ;
25
25
import { Checkbox } from '../../../../base/browser/ui/toggle/toggle.js' ;
26
26
import { IConfigurationService } from '../../../../platform/configuration/common/configuration.js' ;
27
+ import { Command } from '../../../../editor/common/languages.js' ;
28
+ import { ICommandService } from '../../../../platform/commands/common/commands.js' ;
27
29
28
30
export class ChatStatusBarEntry extends Disposable implements IWorkbenchContribution {
29
31
@@ -44,7 +46,8 @@ export class ChatStatusBarEntry extends Disposable implements IWorkbenchContribu
44
46
@IWorkbenchAssignmentService private readonly assignmentService : IWorkbenchAssignmentService ,
45
47
@IProductService private readonly productService : IProductService ,
46
48
@IKeybindingService private readonly keybindingService : IKeybindingService ,
47
- @IConfigurationService private readonly configurationService : IConfigurationService
49
+ @IConfigurationService private readonly configurationService : IConfigurationService ,
50
+ @ICommandService private readonly commandService : ICommandService
48
51
) {
49
52
super ( ) ;
50
53
@@ -93,7 +96,7 @@ export class ChatStatusBarEntry extends Disposable implements IWorkbenchContribu
93
96
94
97
let text = '$(copilot)' ;
95
98
let ariaLabel = localize ( 'chatStatus' , "Copilot Status" ) ;
96
- let command = TOGGLE_CHAT_ACTION_ID ;
99
+ let command : string | Command = TOGGLE_CHAT_ACTION_ID ;
97
100
let tooltip : TooltipContent = localize ( 'openChat' , "Open Chat ({0})" , this . keybindingService . lookupKeybinding ( command ) ?. getLabel ( ) ?? '' ) ;
98
101
99
102
// Quota Exceeded
@@ -105,7 +108,7 @@ export class ChatStatusBarEntry extends Disposable implements IWorkbenchContribu
105
108
} else if ( completionsQuotaExceeded && ! chatQuotaExceeded ) {
106
109
quotaWarning = localize ( 'completionsQuotaExceededStatus' , "Completions limit reached" ) ;
107
110
} else {
108
- quotaWarning = localize ( 'chatAndCompletionsQuotaExceededStatus' , "Copilot limit reached" ) ;
111
+ quotaWarning = localize ( 'chatAndCompletionsQuotaExceededStatus' , "Limit reached" ) ;
109
112
}
110
113
111
114
text = `$(copilot-warning) ${ quotaWarning } ` ;
@@ -139,8 +142,8 @@ export class ChatStatusBarEntry extends Disposable implements IWorkbenchContribu
139
142
140
143
container . appendChild ( $ ( 'div' , undefined , localize ( 'limitTitle' , "You are currently using Copilot Free:" ) ) ) ;
141
144
142
- const chatQuotaIndicator = this . createQuotaIndicator ( container , chatTotal , chatRemaining , localize ( 'chatsLabel' , "Chat Messages " ) ) ;
143
- const completionsQuotaIndicator = this . createQuotaIndicator ( container , completionsTotal , completionsRemaining , localize ( 'completionsLabel' , "Code Completions" ) ) ;
145
+ const chatQuotaIndicator = this . createQuotaIndicator ( container , chatTotal , chatRemaining , localize ( 'chatsLabel' , "Chats Used " ) ) ;
146
+ const completionsQuotaIndicator = this . createQuotaIndicator ( container , completionsTotal , completionsRemaining , localize ( 'completionsLabel' , "Completions Used " ) ) ;
144
147
145
148
this . chatEntitlementsService . resolve ( CancellationToken . None ) . then ( ( ) => {
146
149
const { chatTotal, chatRemaining, completionsTotal, completionsRemaining } = this . chatQuotasService . quotas ;
@@ -149,7 +152,7 @@ export class ChatStatusBarEntry extends Disposable implements IWorkbenchContribu
149
152
completionsQuotaIndicator ( completionsTotal , completionsRemaining ) ;
150
153
} ) ;
151
154
152
- container . appendChild ( $ ( 'div' , undefined , localize ( 'limitQuota' , "Limits will reset on {0}." , this . dateFormatter . format ( quotaResetDate ) ) ) ) ;
155
+ container . appendChild ( $ ( 'div' , undefined , localize ( 'limitQuota' , "Usage will reset on {0}." , this . dateFormatter . format ( quotaResetDate ) ) ) ) ;
153
156
154
157
// Settings
155
158
container . appendChild ( document . createElement ( 'hr' ) ) ;
@@ -161,6 +164,7 @@ export class ChatStatusBarEntry extends Disposable implements IWorkbenchContribu
161
164
162
165
return container ;
163
166
} ;
167
+ command = ShowTooltipCommand ;
164
168
}
165
169
166
170
// Any other User
@@ -177,6 +181,7 @@ export class ChatStatusBarEntry extends Disposable implements IWorkbenchContribu
177
181
178
182
return container ;
179
183
} ;
184
+ command = ShowTooltipCommand ;
180
185
}
181
186
182
187
return {
@@ -206,8 +211,8 @@ export class ChatStatusBarEntry extends Disposable implements IWorkbenchContribu
206
211
207
212
const update = ( total : number | undefined , remaining : number | undefined ) => {
208
213
if ( typeof total === 'number' && typeof remaining === 'number' ) {
209
- quotaText . textContent = localize ( 'quotaDisplay' , "{0} / {1}" , remaining , total ) ;
210
- quotaBit . style . width = `${ ( remaining / total ) * 100 } %` ;
214
+ quotaText . textContent = localize ( 'quotaDisplay' , "{0} / {1}" , total - remaining , total ) ;
215
+ quotaBit . style . width = `${ ( ( total - remaining ) / total ) * 100 } %` ;
211
216
}
212
217
} ;
213
218
@@ -231,10 +236,16 @@ export class ChatStatusBarEntry extends Disposable implements IWorkbenchContribu
231
236
232
237
const shortcut = append ( shortcuts , $ ( 'div.shortcut' ) ) ;
233
238
234
- append ( shortcut , $ ( 'span.shortcut-label' , undefined , entry . text ) ) ;
239
+ const shortcutLabel = append ( shortcut , $ ( 'span.shortcut-label' , undefined , entry . text ) ) ;
235
240
236
241
const shortcutKey = disposables . add ( new KeybindingLabel ( shortcut , OS , { ...defaultKeybindingLabelStyles } ) ) ;
237
242
shortcutKey . set ( keys ) ;
243
+
244
+ for ( const element of [ shortcutLabel , shortcutKey . element ] ) {
245
+ disposables . add ( addDisposableListener ( element , EventType . CLICK , e => {
246
+ this . commandService . executeCommand ( entry . id ) ;
247
+ } ) ) ;
248
+ }
238
249
}
239
250
240
251
return shortcuts ;
0 commit comments