mirror of
https://github.com/microsoft/vscode.git
synced 2026-08-20 07:12:43 +01:00
chat - trigger commands to refresh tokens as needed (#235952)
This commit is contained in:
@@ -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');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user