Skip to content

Commit 9f29633

Browse files
authored
feat: improve AI settings search tooltip label (microsoft#251163)
feat: add AI settings search loading tooltip text
1 parent 99b897a commit 9f29633

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

src/vs/base/browser/ui/toggle/toggle.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,12 @@ export class ToggleActionViewItem extends BaseActionViewItem {
5555
constructor(context: unknown, action: IAction, options: IActionViewItemOptions) {
5656
super(context, action, options);
5757

58+
const title = (<IActionViewItemOptions>this.options).keybinding ?
59+
`${this._action.label} (${(<IActionViewItemOptions>this.options).keybinding})` : this._action.label;
5860
this.toggle = this._register(new Toggle({
5961
actionClassName: this._action.class,
6062
isChecked: !!this._action.checked,
61-
title: (<IActionViewItemOptions>this.options).keybinding ? `${this._action.label} (${(<IActionViewItemOptions>this.options).keybinding})` : this._action.label,
63+
title,
6264
notFocusable: true,
6365
inputActiveOptionBackground: options.toggleStyles?.inputActiveOptionBackground,
6466
inputActiveOptionBorder: options.toggleStyles?.inputActiveOptionBorder,
@@ -94,6 +96,12 @@ export class ToggleActionViewItem extends BaseActionViewItem {
9496
this.toggle.checked = !!this._action.checked;
9597
}
9698

99+
protected override updateLabel(): void {
100+
const title = (<IActionViewItemOptions>this.options).keybinding ?
101+
`${this._action.label} (${(<IActionViewItemOptions>this.options).keybinding})` : this._action.label;
102+
this.toggle.setTitle(title);
103+
}
104+
97105
override focus(): void {
98106
this.toggle.domNode.tabIndex = 0;
99107
this.toggle.focus();

src/vs/workbench/contrib/preferences/browser/settingsEditor2.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -634,11 +634,18 @@ export class SettingsEditor2 extends EditorPane {
634634
if (!setupHidden && showSuggestions) {
635635
const showAiResultActionClassNames = ['action-label', ThemeIcon.asClassName(preferencesAiResultsIcon)];
636636
const searchServiceEnabled = this.aiSettingsSearchService.isEnabled();
637+
637638
this.showAiResultsAction = this._register(new Action(SETTINGS_EDITOR_COMMAND_SHOW_AI_RESULTS,
638-
localize('showAiResultsDescription', "Search settings with AI"), showAiResultActionClassNames.join(' '), searchServiceEnabled
639+
searchServiceEnabled
640+
? localize('showAiResultsDescription', "Search settings with AI")
641+
: localize('showAiResultsNotReady', "AI search functionality loading..."),
642+
showAiResultActionClassNames.join(' '), searchServiceEnabled
639643
));
640644
this._register(this.aiSettingsSearchService.onProviderRegistered(() => {
641-
this.showAiResultsAction!.enabled = true;
645+
if (this.showAiResultsAction) {
646+
this.showAiResultsAction.label = localize('showAiResultsDescription', "Search settings with AI");
647+
this.showAiResultsAction.enabled = true;
648+
}
642649
}));
643650
this._register(this.showAiResultsAction.onDidChange(() => {
644651
this.onSearchInputChanged(true);
@@ -724,7 +731,7 @@ export class SettingsEditor2 extends EditorPane {
724731
return this.instantiationService.createInstance(SettingsSearchFilterDropdownMenuActionViewItem, action, options, this.actionRunner, this.searchWidget);
725732
}
726733
if (this.showAiResultsAction && action.id === this.showAiResultsAction.id) {
727-
return new ToggleActionViewItem(null, action, { ...options, toggleStyles: defaultToggleStyles });
734+
return new ToggleActionViewItem(null, action, { ...options, keybinding: 'Ctrl+I', toggleStyles: defaultToggleStyles });
728735
}
729736
return undefined;
730737
}

0 commit comments

Comments
 (0)