diff --git a/src/vs/workbench/contrib/chat/browser/chatSetup.ts b/src/vs/workbench/contrib/chat/browser/chatSetup.ts index 37544c7ec93..3af2ce5f98c 100644 --- a/src/vs/workbench/contrib/chat/browser/chatSetup.ts +++ b/src/vs/workbench/contrib/chat/browser/chatSetup.ts @@ -266,7 +266,7 @@ export class ChatSetupContribution extends Disposable implements IWorkbenchContr const entitlement = await that.requests.forceResolveEntitlement(undefined); if (entitlement === ChatEntitlement.Pro) { - commandService.executeCommand('github.copilot.refreshToken'); // ugly, but we need to signal to the extension that entitlements changed + refreshTokens(commandService); } } } @@ -787,7 +787,7 @@ class ChatSetupController extends Disposable { installResult = isCancellationError(error) ? 'cancelled' : 'failedInstall'; } finally { if (wasInstalled && didSignUp) { - this.commandService.executeCommand('github.copilot.refreshToken'); // ugly, but we need to signal to the extension that sign-up happened + refreshTokens(this.commandService); } if (installResult === 'installed') { @@ -1088,3 +1088,9 @@ function showCopilotView(viewsService: IViewsService, layoutService: IWorkbenchL return showChatView(viewsService); } } + +function refreshTokens(commandService: ICommandService): void { + // ugly, but we need to signal to the extension that entitlements changed + commandService.executeCommand('github.copilot.signIn'); + commandService.executeCommand('github.copilot.refreshToken'); +}