Skip to content

Commit d1c7e48

Browse files
authored
chat - defer revealing of chat view to after sign-in dialog (microsoft#249102)
1 parent d31ea9d commit d1c7e48

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

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

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ class SetupAgent extends Disposable implements IChatAgentImplementation {
397397

398398
let result: IChatSetupResult | undefined = undefined;
399399
try {
400-
result = await ChatSetup.getInstance(this.instantiationService, this.context, this.controller).run();
400+
result = await ChatSetup.getInstance(this.instantiationService, this.context, this.controller).run({ disableChatViewReveal: true /* we are already in a chat context */ });
401401
} catch (error) {
402402
this.logService.error(`[chat setup] Error during setup: ${toErrorMessage(error)}`);
403403
} finally {
@@ -577,7 +577,7 @@ class ChatSetup {
577577
let instance = ChatSetup.instance;
578578
if (!instance) {
579579
instance = ChatSetup.instance = instantiationService.invokeFunction(accessor => {
580-
return new ChatSetup(context, controller, instantiationService, accessor.get(ITelemetryService), accessor.get(IWorkbenchLayoutService), accessor.get(IKeybindingService), accessor.get(IChatEntitlementService), accessor.get(ILogService), accessor.get(IConfigurationService));
580+
return new ChatSetup(context, controller, instantiationService, accessor.get(ITelemetryService), accessor.get(IWorkbenchLayoutService), accessor.get(IKeybindingService), accessor.get(IChatEntitlementService), accessor.get(ILogService), accessor.get(IConfigurationService), accessor.get(IViewsService));
581581
});
582582
}
583583

@@ -597,19 +597,20 @@ class ChatSetup {
597597
@IKeybindingService private readonly keybindingService: IKeybindingService,
598598
@IChatEntitlementService private readonly chatEntitlementService: IChatEntitlementService,
599599
@ILogService private readonly logService: ILogService,
600-
@IConfigurationService private readonly configurationService: IConfigurationService
600+
@IConfigurationService private readonly configurationService: IConfigurationService,
601+
@IViewsService private readonly viewsService: IViewsService
601602
) { }
602603

603604
skipDialog(): void {
604605
this.skipDialogOnce = true;
605606
}
606607

607-
async run(): Promise<IChatSetupResult> {
608+
async run(options?: { disableChatViewReveal?: boolean }): Promise<IChatSetupResult> {
608609
if (this.pendingRun) {
609610
return this.pendingRun;
610611
}
611612

612-
this.pendingRun = this.doRun();
613+
this.pendingRun = this.doRun(options);
613614

614615
try {
615616
return await this.pendingRun;
@@ -618,7 +619,7 @@ class ChatSetup {
618619
}
619620
}
620621

621-
private async doRun(): Promise<IChatSetupResult> {
622+
private async doRun(options?: { disableChatViewReveal?: boolean }): Promise<IChatSetupResult> {
622623
const dialogSkipped = this.skipDialogOnce;
623624
this.skipDialogOnce = false;
624625

@@ -633,6 +634,12 @@ class ChatSetup {
633634
setupStrategy = ChatSetupStrategy.SetupWithEnterpriseProvider; // users with a configured provider go through provider setup
634635
}
635636

637+
if (setupStrategy !== ChatSetupStrategy.Canceled && !options?.disableChatViewReveal) {
638+
// Show the chat view now to better indicate progress
639+
// while installing the extension or returning from sign in
640+
showCopilotView(this.viewsService, this.layoutService);
641+
}
642+
636643
let success = undefined;
637644
try {
638645
switch (setupStrategy) {
@@ -838,9 +845,8 @@ export class ChatSetupContribution extends Disposable implements IWorkbenchContr
838845

839846
await context.update({ hidden: false });
840847

841-
const chatWidgetPromise = showCopilotView(viewsService, layoutService);
842848
if (mode) {
843-
const chatWidget = await chatWidgetPromise;
849+
const chatWidget = await showCopilotView(viewsService, layoutService);
844850
chatWidget?.input.setChatMode(mode);
845851
}
846852

0 commit comments

Comments
 (0)