@@ -56,6 +56,7 @@ import { CHAT_EDITING_SIDEBAR_PANEL_ID, CHAT_SIDEBAR_PANEL_ID } from './chatView
56
56
import { ChatViewsWelcomeExtensions , IChatViewsWelcomeContributionRegistry } from './viewsWelcome/chatViewsWelcome.js' ;
57
57
import { IChatQuotasService } from './chatQuotasService.js' ;
58
58
import { Checkbox } from '../../../../base/browser/ui/toggle/toggle.js' ;
59
+ import { mainWindow } from '../../../../base/browser/window.js' ;
59
60
60
61
const defaultChat = {
61
62
extensionId : product . defaultChatAgent ?. extensionId ?? '' ,
@@ -341,6 +342,15 @@ class ChatSetupRequests extends Disposable {
341
342
this . resolve ( ) ;
342
343
}
343
344
} ) ) ;
345
+
346
+ this . _register ( this . context . onDidChange ( ( ) => {
347
+ if ( ! this . context . state . installed || this . context . state . entitlement === ChatEntitlement . Unknown ) {
348
+ // When the extension is not installed or the user is not entitled
349
+ // make sure to clear quotas so that any indicators are also gone
350
+ this . state = { entitlement : this . state . entitlement , quotas : undefined } ;
351
+ this . chatQuotasService . clearQuotas ( ) ;
352
+ }
353
+ } ) ) ;
344
354
}
345
355
346
356
private async resolve ( ) : Promise < void > {
@@ -737,7 +747,8 @@ class ChatSetupController extends Disposable {
737
747
738
748
this . telemetryService . publicLog2 < InstallChatEvent , InstallChatClassification > ( 'commandCenter.chatInstall' , { installResult, signedIn } ) ;
739
749
740
- if ( activeElement === getActiveElement ( ) ) {
750
+ const currentActiveElement = getActiveElement ( ) ;
751
+ if ( activeElement === currentActiveElement || currentActiveElement === mainWindow . document . body ) {
741
752
( await showCopilotView ( this . viewsService ) ) ?. focusInput ( ) ;
742
753
}
743
754
}
0 commit comments