Skip to content

Commit 85371fa

Browse files
committed
use hint for notifications
1 parent 924ae6c commit 85371fa

File tree

1 file changed

+21
-4
lines changed

1 file changed

+21
-4
lines changed

src/vs/workbench/browser/parts/notifications/notificationsToasts.ts

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ import { IHostService } from 'vs/workbench/services/host/browser/host';
2525
import { IntervalCounter } from 'vs/base/common/async';
2626
import { assertIsDefined } from 'vs/base/common/types';
2727
import { NotificationsToastsVisibleContext } from 'vs/workbench/common/contextkeys';
28+
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
29+
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
2830

2931
interface INotificationToast {
3032
readonly item: INotificationViewItem;
@@ -83,7 +85,9 @@ export class NotificationsToasts extends Themable implements INotificationsToast
8385
@IEditorGroupsService private readonly editorGroupService: IEditorGroupsService,
8486
@IContextKeyService private readonly contextKeyService: IContextKeyService,
8587
@ILifecycleService private readonly lifecycleService: ILifecycleService,
86-
@IHostService private readonly hostService: IHostService
88+
@IHostService private readonly hostService: IHostService,
89+
@IKeybindingService private readonly _keybindingService: IKeybindingService,
90+
@IConfigurationService private readonly _configurationService: IConfigurationService
8791
) {
8892
super(themeService);
8993

@@ -187,11 +191,24 @@ export class NotificationsToasts extends Themable implements INotificationsToast
187191
const notificationList = this.instantiationService.createInstance(NotificationsList, notificationToast, {
188192
verticalScrollMode: ScrollbarVisibility.Hidden,
189193
widgetAriaLabel: (() => {
190-
if (!item.source) {
191-
return localize('notificationAriaLabel', "{0}, notification", item.message.raw);
194+
let accessibleViewHint: string | undefined;
195+
const keybinding = this._keybindingService.lookupKeybinding('editor.action.accessibleView')?.getAriaLabel();
196+
if (this._configurationService.getValue('accessibility.verbosity.notification')) {
197+
accessibleViewHint = keybinding ? localize('chatAccessibleViewHint', "Inspect the response in the accessible view with {0}", keybinding) : localize('chatAccessibleViewHintNoKb', "Inspect the response in the accessible view via the command Open Accessible View which is currently not triggerable via keybinding");
192198
}
193199

194-
return localize('notificationWithSourceAriaLabel', "{0}, source: {1}, notification", item.message.raw, item.source);
200+
if (!item.source) {
201+
if (accessibleViewHint) {
202+
return localize('notificationAriaLabelViewHint', "{0}, notification {1}", item.message.raw, accessibleViewHint);
203+
} else {
204+
return localize('notificationAriaLabel', "{0}, notification", item.message.raw);
205+
}
206+
}
207+
if (accessibleViewHint) {
208+
return localize('notificationWithSourceAriaLabelViewHint', "{0}, source: {1}, notification {2}", item.message.raw, item.source, accessibleViewHint);
209+
} else {
210+
return localize('notificationWithSourceAriaLabel', "{0}, source: {1}, notification", item.message.raw, item.source);
211+
}
195212
})()
196213
});
197214
itemDisposables.add(notificationList);

0 commit comments

Comments
 (0)