Skip to content

Commit b2c19e6

Browse files
authored
chat - continue installation independent of sign-in result (microsoft#250606)
1 parent d1895da commit b2c19e6

File tree

2 files changed

+19
-13
lines changed

2 files changed

+19
-13
lines changed

src/vs/workbench/contrib/chat/browser/chatInputPart.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -436,9 +436,9 @@ export class ChatInputPart extends Disposable implements IHistoryNavigationWidge
436436
this._chatEditsDisposables = this._register(new DisposableStore());
437437
this._attemptedWorkingSetEntriesCount = 0;
438438

439-
this.editorService.onDidActiveEditorChange(() => {
439+
this._register(this.editorService.onDidActiveEditorChange(() => {
440440
this._indexOfLastOpenedContext = -1;
441-
});
441+
}));
442442

443443
this._attachmentModel = this._register(this.instantiationService.createInstance(ChatAttachmentModel));
444444
this.selectedToolsModel = this._register(this.instantiationService.createInstance(ChatSelectedTools, observableFromEvent(this, this.onDidChangeCurrentChatMode, () => this.currentMode)));

src/vs/workbench/contrib/chat/browser/chatSetup.ts

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ class SetupAgent extends Disposable implements IChatAgentImplementation {
192192
return { agent, disposable: disposables };
193193
}
194194

195-
private static readonly SETUP_NEEDED_MESSAGE = new MarkdownString(localize('settingUpCopilotNeeded', "You need to set up Copilot to use Chat."));
195+
private static readonly SETUP_NEEDED_MESSAGE = new MarkdownString(localize('settingUpCopilotNeeded', "You need to set up Copilot and be signed in to use Chat."));
196196

197197
private readonly _onUnresolvableError = this._register(new Emitter<void>());
198198
readonly onUnresolvableError = this._onUnresolvableError.event;
@@ -1438,6 +1438,8 @@ class ChatSetupController extends Disposable {
14381438
this.setStep(ChatSetupStep.SigningIn);
14391439
const result = await this.signIn(providerId);
14401440
if (!result.session) {
1441+
this.doInstall(); // still install the extension in the background to remind the user to sign-in eventually
1442+
14411443
this.telemetryService.publicLog2<InstallChatEvent, InstallChatClassification>('commandCenter.chatInstall', { installResult: 'failedNotSignedIn', installDuration: watch.elapsed(), signUpErrorCode: undefined });
14421444
return undefined; // treat as cancelled because signing in already triggers an error dialog
14431445
}
@@ -1521,7 +1523,7 @@ class ChatSetupController extends Disposable {
15211523
}
15221524
}
15231525

1524-
await this.doInstall();
1526+
await this.doInstallWithRetry();
15251527
} catch (error) {
15261528
this.logService.error(`[chat setup] install: error ${error}`);
15271529
this.telemetryService.publicLog2<InstallChatEvent, InstallChatClassification>('commandCenter.chatInstall', { installResult: isCancellationError(error) ? 'cancelled' : 'failedInstall', installDuration: watch.elapsed(), signUpErrorCode: undefined });
@@ -1539,16 +1541,10 @@ class ChatSetupController extends Disposable {
15391541
return true;
15401542
}
15411543

1542-
private async doInstall(): Promise<void> {
1544+
private async doInstallWithRetry(): Promise<void> {
15431545
let error: Error | undefined;
15441546
try {
1545-
await this.extensionsWorkbenchService.install(defaultChat.extensionId, {
1546-
enable: true,
1547-
isApplicationScoped: true, // install into all profiles
1548-
isMachineScoped: false, // do not ask to sync
1549-
installEverywhere: true, // install in local and remote
1550-
installPreReleaseVersion: this.productService.quality !== 'stable'
1551-
}, ChatViewId);
1547+
await this.doInstall();
15521548
} catch (e) {
15531549
this.logService.error(`[chat setup] install: error ${error}`);
15541550
error = e;
@@ -1564,14 +1560,24 @@ class ChatSetupController extends Disposable {
15641560
});
15651561

15661562
if (confirmed) {
1567-
return this.doInstall();
1563+
return this.doInstallWithRetry();
15681564
}
15691565
}
15701566

15711567
throw error;
15721568
}
15731569
}
15741570

1571+
private async doInstall(): Promise<void> {
1572+
await this.extensionsWorkbenchService.install(defaultChat.extensionId, {
1573+
enable: true,
1574+
isApplicationScoped: true, // install into all profiles
1575+
isMachineScoped: false, // do not ask to sync
1576+
installEverywhere: true, // install in local and remote
1577+
installPreReleaseVersion: this.productService.quality !== 'stable'
1578+
}, ChatViewId);
1579+
}
1580+
15751581
async setupWithProvider(options: { useEnterpriseProvider: boolean }): Promise<ChatSetupResultValue> {
15761582
const registry = Registry.as<IConfigurationRegistry>(ConfigurationExtensions.Configuration);
15771583
registry.registerConfiguration({

0 commit comments

Comments
 (0)