mirror of
https://github.com/microsoft/vscode.git
synced 2025-12-10 00:27:05 -06:00
This reverts commit 4e32b0176650f146d33e238e90463a331e542085.
This commit is contained in:
parent
a3a5f7c300
commit
cb0c47c0cf
@ -1252,13 +1252,13 @@ class ChatSetupController extends Disposable {
|
||||
let session: AuthenticationSession | undefined;
|
||||
let entitlement: ChatEntitlement | undefined;
|
||||
|
||||
const installation = this.doInstall();
|
||||
|
||||
// Entitlement Unknown or `forceSignIn`: we need to sign-in user
|
||||
if (this.context.state.entitlement === ChatEntitlement.Unknown || options.forceSignIn) {
|
||||
this.setStep(ChatSetupStep.SigningIn);
|
||||
const result = await this.signIn({ useAlternateProvider: options.useAlternateProvider });
|
||||
if (!result.session) {
|
||||
this.doInstall(); // still install the extension in the background to remind the user to sign-in eventually
|
||||
|
||||
const provider = options.useAlternateProvider ? defaultChat.alternativeProviderId : options.useEnterpriseProvider ? defaultChat.enterpriseProviderId : defaultChat.providerName;
|
||||
this.telemetryService.publicLog2<InstallChatEvent, InstallChatClassification>('commandCenter.chatInstall', { installResult: 'failedNotSignedIn', installDuration: watch.elapsed(), signUpErrorCode: undefined, provider });
|
||||
return undefined; // treat as cancelled because signing in already triggers an error dialog
|
||||
@ -1270,7 +1270,7 @@ class ChatSetupController extends Disposable {
|
||||
|
||||
// Await Install
|
||||
this.setStep(ChatSetupStep.Installing);
|
||||
success = await this.install(session, entitlement ?? this.context.state.entitlement, providerId, watch, installation, options);
|
||||
success = await this.install(session, entitlement ?? this.context.state.entitlement, providerId, watch, options);
|
||||
} finally {
|
||||
this.setStep(ChatSetupStep.Initial);
|
||||
this.context.resume();
|
||||
@ -1304,7 +1304,7 @@ class ChatSetupController extends Disposable {
|
||||
return { session, entitlement: entitlements?.entitlement };
|
||||
}
|
||||
|
||||
private async install(session: AuthenticationSession | undefined, entitlement: ChatEntitlement, providerId: string, watch: StopWatch, installation: Promise<void>, options: { useAlternateProvider?: boolean; useEnterpriseProvider?: boolean }): Promise<ChatSetupResultValue> {
|
||||
private async install(session: AuthenticationSession | undefined, entitlement: ChatEntitlement, providerId: string, watch: StopWatch, options: { useAlternateProvider?: boolean; useEnterpriseProvider?: boolean }): Promise<ChatSetupResultValue> {
|
||||
const wasRunning = this.context.state.installed && !this.context.state.disabled;
|
||||
let signUpResult: boolean | { errorCode: number } | undefined = undefined;
|
||||
|
||||
@ -1337,7 +1337,7 @@ class ChatSetupController extends Disposable {
|
||||
}
|
||||
}
|
||||
|
||||
await this.doInstallWithRetry(installation);
|
||||
await this.doInstallWithRetry();
|
||||
} catch (error) {
|
||||
this.logService.error(`[chat setup] install: error ${error}`);
|
||||
this.telemetryService.publicLog2<InstallChatEvent, InstallChatClassification>('commandCenter.chatInstall', { installResult: isCancellationError(error) ? 'cancelled' : 'failedInstall', installDuration: watch.elapsed(), signUpErrorCode: undefined, provider });
|
||||
@ -1355,10 +1355,10 @@ class ChatSetupController extends Disposable {
|
||||
return true;
|
||||
}
|
||||
|
||||
private async doInstallWithRetry(installation: Promise<void>): Promise<void> {
|
||||
private async doInstallWithRetry(): Promise<void> {
|
||||
let error: Error | undefined;
|
||||
try {
|
||||
await installation;
|
||||
await this.doInstall();
|
||||
} catch (e) {
|
||||
this.logService.error(`[chat setup] install: error ${error}`);
|
||||
error = e;
|
||||
@ -1374,7 +1374,7 @@ class ChatSetupController extends Disposable {
|
||||
});
|
||||
|
||||
if (confirmed) {
|
||||
return this.doInstallWithRetry(this.doInstall());
|
||||
return this.doInstallWithRetry();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user