Skip to content

Commit 74cefc6

Browse files
authored
chat - tweaks to welcome (microsoft#234556)
* chat - tweaks to welcome * . * . * . * . * . * . * . * .
1 parent deda781 commit 74cefc6

File tree

5 files changed

+40
-18
lines changed

5 files changed

+40
-18
lines changed

src/vs/base/common/product.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,6 @@ export interface IDefaultChatAgent {
312312
readonly chatWelcomeTitle: string;
313313
readonly documentationUrl: string;
314314
readonly privacyStatementUrl: string;
315-
readonly collectionDocumentationUrl: string;
316315
readonly skusDocumentationUrl: string;
317316
readonly providerId: string;
318317
readonly providerName: string;

src/vs/workbench/contrib/chat/browser/actions/chatActions.ts

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -470,11 +470,20 @@ export function registerChatActions() {
470470
id: LearnMoreChatAction.ID,
471471
title: LearnMoreChatAction.TITLE,
472472
category: CHAT_CATEGORY,
473-
menu: {
474-
id: MenuId.ChatCommandCenter,
475-
group: 'z_learn',
476-
order: 1
477-
}
473+
menu: [
474+
{
475+
id: MenuId.ChatCommandCenter,
476+
group: 'z_learn',
477+
order: 1,
478+
when: ChatContextKeys.Setup.installed
479+
},
480+
{
481+
id: MenuId.ChatCommandCenter,
482+
group: 'a_first',
483+
order: 2,
484+
when: ChatContextKeys.Setup.installed.toNegated()
485+
}
486+
]
478487
});
479488
}
480489

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ import { ChatGettingStartedContribution } from './actions/chatGettingStarted.js'
7979
import { Extensions, IConfigurationMigrationRegistry } from '../../../common/configuration.js';
8080
import { ChatEditorOverlayController } from './chatEditorOverlay.js';
8181
import { ChatRelatedFilesContribution } from './contrib/chatInputRelatedFilesContrib.js';
82+
import product from '../../../../platform/product/common/product.js';
8283

8384
// Register configuration
8485
const configurationRegistry = Registry.as<IConfigurationRegistry>(ConfigurationExtensions.Configuration);
@@ -116,7 +117,7 @@ configurationRegistry.registerConfiguration({
116117
'chat.commandCenter.enabled': {
117118
type: 'boolean',
118119
tags: ['preview'],
119-
markdownDescription: nls.localize('chat.commandCenter.enabled', "Controls whether the command center shows a menu for chat actions (requires {0}).", '`#window.commandCenter#`'),
120+
markdownDescription: nls.localize('chat.commandCenter.enabled', "Controls whether the command center shows a menu for chat actions to control {0} (requires {1}).", product.defaultChatAgent?.chatName, '`#window.commandCenter#`'),
120121
default: true
121122
},
122123
'chat.experimental.offerSetup': {

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

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,12 @@ import { MarkdownString } from '../../../../base/common/htmlContent.js';
4646

4747
const defaultChat = {
4848
extensionId: product.defaultChatAgent?.extensionId ?? '',
49+
chatExtensionId: product.defaultChatAgent?.chatExtensionId ?? '',
4950
name: product.defaultChatAgent?.name ?? '',
5051
icon: Codicon[product.defaultChatAgent?.icon as keyof typeof Codicon ?? 'commentDiscussion'],
5152
chatWelcomeTitle: product.defaultChatAgent?.chatWelcomeTitle ?? '',
5253
documentationUrl: product.defaultChatAgent?.documentationUrl ?? '',
5354
privacyStatementUrl: product.defaultChatAgent?.privacyStatementUrl ?? '',
54-
collectionDocumentationUrl: product.defaultChatAgent?.collectionDocumentationUrl ?? '',
5555
skusDocumentationUrl: product.defaultChatAgent?.skusDocumentationUrl ?? '',
5656
providerId: product.defaultChatAgent?.providerId ?? '',
5757
providerName: product.defaultChatAgent?.providerName ?? '',
@@ -468,7 +468,7 @@ class ChatSetupController extends Disposable {
468468

469469
installResult = 'installed';
470470
} catch (error) {
471-
this.logService.trace(`[chat setup] install: error ${error}`);
471+
this.logService.error(`[chat setup] install: error ${error}`);
472472

473473
installResult = isCancellationError(error) ? 'cancelled' : 'failedInstall';
474474
}
@@ -519,7 +519,7 @@ class ChatSetupWelcomeContent extends Disposable {
519519
const limitedSkuHeaderElement = this.element.appendChild($('p')).appendChild(this._register(markdown.render(new MarkdownString(limitedSkuHeader, { isTrusted: true }))).element);
520520

521521
const telemetryLabel = localize('telemetryLabel', "Allow {0} to use my data, including Prompts, Suggestions, and Code Snippets, for product improvements", defaultChat.providerName);
522-
const { container: telemetryContainer, checkbox: telemetryCheckbox } = this.createCheckBox(telemetryLabel, this.telemetryService.telemetryLevel === TelemetryLevel.NONE ? false : false);
522+
const { container: telemetryContainer, checkbox: telemetryCheckbox } = this.createCheckBox(telemetryLabel, this.telemetryService.telemetryLevel === TelemetryLevel.NONE ? false : true);
523523

524524
const detectionLabel = localize('detectionLabel', "Allow suggestions matching public code");
525525
const { container: detectionContainer, checkbox: detectionCheckbox } = this.createCheckBox(detectionLabel, true);
@@ -530,23 +530,24 @@ class ChatSetupWelcomeContent extends Disposable {
530530
this._register(button.onDidClick(() => this.controller.setup(telemetryCheckbox.checked, detectionCheckbox.checked)));
531531

532532
// Footer
533-
const footer = localize({ key: 'privacyFooter', comment: ['{Locked="]({0})"}'] }, "By proceeding you agree to our [privacy statement]({0}). You can [learn more]({1}) about {2}.", defaultChat.privacyStatementUrl, defaultChat.documentationUrl, defaultChat.name);
533+
const footer = localize({ key: 'privacyFooter', comment: ['{Locked="]({0})"}'] }, "By proceeding you agree to our [privacy statement]({0}). Click [here]({1}) to learn more about {2}.", defaultChat.privacyStatementUrl, defaultChat.documentationUrl, defaultChat.name);
534534
this.element.appendChild($('p')).appendChild(this._register(markdown.render(new MarkdownString(footer, { isTrusted: true }))).element);
535535

536536
// Update based on model state
537537
this._register(Event.runAndSubscribe(this.controller.onDidChange, () => this.update([limitedSkuHeaderElement, telemetryContainer, detectionContainer], [telemetryCheckbox, detectionCheckbox], button)));
538538
}
539539

540540
private createCheckBox(label: string, checked: boolean): { container: HTMLElement; checkbox: Checkbox } {
541-
const container = this.element.appendChild($('p'));
541+
const container = this.element.appendChild($('p.checkbox-container'));
542542
const checkbox = this._register(new Checkbox(label, checked, defaultCheckboxStyles));
543543
container.appendChild(checkbox.domNode);
544544

545-
const checkboxLabel = container.appendChild($('div'));
545+
const checkboxLabel = container.appendChild($('div.checkbox-label'));
546546
checkboxLabel.textContent = label;
547547
this._register(addDisposableListener(checkboxLabel, EventType.CLICK, () => {
548548
if (checkbox?.enabled) {
549549
checkbox.checked = !checkbox.checked;
550+
checkbox.focus();
550551
}
551552
}));
552553

@@ -717,17 +718,20 @@ class ChatSetupTriggerAction extends Action2 {
717718
override async run(accessor: ServicesAccessor): Promise<void> {
718719
const viewsService = accessor.get(IViewsService);
719720
const instantiationService = accessor.get(IInstantiationService);
721+
const configurationService = accessor.get(IConfigurationService);
720722

721723
instantiationService.createInstance(ChatSetupContextKeys).update({ triggered: true });
722724

723725
showChatView(viewsService);
726+
727+
configurationService.updateValue('chat.commandCenter.enabled', true);
724728
}
725729
}
726730

727731
class ChatSetupHideAction extends Action2 {
728732

729733
static readonly ID = 'workbench.action.chat.hideSetup';
730-
static readonly TITLE = localize2('hideChatSetup', "Hide {0}", defaultChat.name);
734+
static readonly TITLE = localize2('hideChatSetup', "Hide {0}...", defaultChat.name);
731735

732736
constructor() {
733737
super({
@@ -737,8 +741,8 @@ class ChatSetupHideAction extends Action2 {
737741
precondition: ChatContextKeys.Setup.installed.negate(),
738742
menu: {
739743
id: MenuId.ChatCommandCenter,
740-
group: 'a_first',
741-
order: 2,
744+
group: 'z_hide',
745+
order: 1,
742746
when: ChatContextKeys.Setup.installed.negate()
743747
}
744748
});
@@ -753,8 +757,8 @@ class ChatSetupHideAction extends Action2 {
753757

754758
const { confirmed } = await dialogService.confirm({
755759
message: localize('hideChatSetupConfirm', "Are you sure you want to hide {0}?", defaultChat.name),
756-
detail: localize('hideChatSetupDetail', "You can restore chat controls from the 'chat.commandCenter.enabled' setting."),
757-
primaryButton: localize('hideChatSetup', "Hide {0}", defaultChat.name)
760+
detail: localize('hideChatSetupDetail', "You can restore it by running the '{0}' command.", ChatSetupTriggerAction.TITLE.value),
761+
primaryButton: localize('hideChatSetupButton', "Hide {0}", defaultChat.name)
758762
});
759763

760764
if (!confirmed) {

src/vs/workbench/contrib/chat/browser/media/chatViewSetup.css

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,13 @@
2222
width: 100%;
2323
padding: 4px 7px;
2424
}
25+
26+
p.checkbox-container {
27+
display: flex;
28+
}
29+
30+
div.checkbox-label {
31+
flex-basis: fit-content;
32+
cursor: pointer;
33+
}
2534
}

0 commit comments

Comments
 (0)