Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupRunner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import { ChatSetupController } from './chatSetupController.js';
import { IChatSetupResult, ChatSetupAnonymous, InstallChatEvent, InstallChatClassification, ChatSetupStrategy, ChatSetupResultValue } from './chatSetup.js';
import { IDefaultAccountService } from '../../../../../platform/defaultAccount/common/defaultAccount.js';
import { IHostService } from '../../../../services/host/browser/host.js';
import { IWorkbenchAssignmentService } from '../../../../services/assignment/common/assignmentService.js';

const defaultChat = {
publicCodeMatchesUrl: product.defaultChatAgent?.publicCodeMatchesUrl ?? '',
Expand All @@ -49,7 +50,7 @@ export class ChatSetup {
let instance = ChatSetup.instance;
if (!instance) {
instance = ChatSetup.instance = instantiationService.invokeFunction(accessor => {
return new ChatSetup(context, controller, accessor.get(ITelemetryService), accessor.get(IWorkbenchLayoutService), accessor.get(IKeybindingService), accessor.get(IChatEntitlementService) as ChatEntitlementService, accessor.get(ILogService), accessor.get(IChatWidgetService), accessor.get(IWorkspaceTrustRequestService), accessor.get(IMarkdownRendererService), accessor.get(IDefaultAccountService), accessor.get(IHostService));
return new ChatSetup(context, controller, accessor.get(ITelemetryService), accessor.get(IWorkbenchLayoutService), accessor.get(IKeybindingService), accessor.get(IChatEntitlementService) as ChatEntitlementService, accessor.get(ILogService), accessor.get(IChatWidgetService), accessor.get(IWorkspaceTrustRequestService), accessor.get(IMarkdownRendererService), accessor.get(IDefaultAccountService), accessor.get(IHostService), accessor.get(IWorkbenchAssignmentService));
});
}

Expand All @@ -72,7 +73,8 @@ export class ChatSetup {
@IWorkspaceTrustRequestService private readonly workspaceTrustRequestService: IWorkspaceTrustRequestService,
@IMarkdownRendererService private readonly markdownRendererService: IMarkdownRendererService,
@IDefaultAccountService private readonly defaultAccountService: IDefaultAccountService,
@IHostService private readonly hostService: IHostService
@IHostService private readonly hostService: IHostService,
@IWorkbenchAssignmentService private readonly experimentService: IWorkbenchAssignmentService,
) { }

skipDialog(): void {
Expand Down Expand Up @@ -162,7 +164,8 @@ export class ChatSetup {
private async showDialog(options?: { forceSignInDialog?: boolean; forceAnonymous?: ChatSetupAnonymous }): Promise<ChatSetupStrategy> {
const disposables = new DisposableStore();

const buttons = this.getButtons(options);
const useCloseButton = await this.experimentService.getTreatment<boolean>('chatSetupDialogCloseButton');
const buttons = this.getButtons(options, useCloseButton);

const dialog = disposables.add(new Dialog(
this.layoutService.activeContainer,
Expand All @@ -174,8 +177,8 @@ export class ChatSetup {
detail: ' ', // workaround allowing us to render the message in large
icon: Codicon.copilotLarge,
alignment: DialogContentsAlignment.Vertical,
cancelId: buttons.length - 1,
disableCloseButton: true,
cancelId: useCloseButton ? buttons.length : buttons.length - 1,
disableCloseButton: !useCloseButton,
renderFooter: footer => footer.appendChild(this.createDialogFooter(disposables, options)),
buttonOptions: buttons.map(button => button[2])
}, this.keybindingService, this.layoutService, this.hostService)
Expand All @@ -187,7 +190,7 @@ export class ChatSetup {
return buttons[button]?.[1] ?? ChatSetupStrategy.Canceled;
}

private getButtons(options?: { forceSignInDialog?: boolean; forceAnonymous?: ChatSetupAnonymous }): Array<[string, ChatSetupStrategy, { styleButton?: (button: IButton) => void } | undefined]> {
private getButtons(options?: { forceSignInDialog?: boolean; forceAnonymous?: ChatSetupAnonymous }, useCloseButton?: boolean): Array<[string, ChatSetupStrategy, { styleButton?: (button: IButton) => void } | undefined]> {
type ContinueWithButton = [string, ChatSetupStrategy, { styleButton?: (button: IButton) => void } | undefined];
const styleButton = (...classes: string[]) => ({ styleButton: (button: IButton) => button.element.classList.add(...classes) });

Expand Down Expand Up @@ -221,7 +224,9 @@ export class ChatSetup {
buttons = [[localize('setupAIButton', "Use AI Features"), ChatSetupStrategy.DefaultSetup, undefined]];
}

buttons.push([localize('skipForNow', "Skip for now"), ChatSetupStrategy.Canceled, styleButton('link-button', 'skip-button')]);
if (!useCloseButton) {
buttons.push([localize('skipForNow', "Skip for now"), ChatSetupStrategy.Canceled, styleButton('link-button', 'skip-button')]);
}

return buttons;
}
Expand Down
Loading