Skip to content

Commit

Permalink
more instances
Browse files Browse the repository at this point in the history
  • Loading branch information
meganrogge committed Jan 3, 2024
1 parent 12603ce commit f39061c
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 7 deletions.
4 changes: 3 additions & 1 deletion src/vs/platform/accessibility/common/accessibility.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,5 +74,7 @@ export const enum AccessibleNotificationEvent {
TaskFailed = 'taskFailed',
ChatRequestSent = 'chatRequestSent',
NotebookCellCompleted = 'notebookCellCompleted',
NotebookCellFailed = 'notebookCellFailed'
NotebookCellFailed = 'notebookCellFailed',
OnDebugBreak = 'onDebugBreak',
NoInlayHints = 'noInlayHints'
}
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ export const enum AccessibilityAlertSettingId {
TaskFailed = 'accessibility.alert.taskFailed',
ChatRequestSent = 'accessibility.alert.chatRequestSent',
NotebookCellCompleted = 'accessibility.alert.notebookCellCompleted',
NotebookCellFailed = 'accessibility.alert.notebookCellFailed'
NotebookCellFailed = 'accessibility.alert.notebookCellFailed',
OnDebugBreak = 'accessibility.alert.onDebugBreak'
}

export const enum AccessibleViewProviderId {
Expand Down Expand Up @@ -245,6 +246,12 @@ const configuration: IConfigurationNode = {
'default': true,
tags: ['accessibility']
},
[AccessibilityAlertSettingId.OnDebugBreak]: {
'markdownDescription': localize('alert.onDebugBreak', "Alerts when the debugger breaks. Also see {0}.", '`#audioCues.onDebugBreak#`'),
'type': 'boolean',
'default': true,
tags: ['accessibility']
},
[AccessibilityVoiceSettingId.SpeechTimeout]: {
'markdownDescription': localize('voice.speechTimeout', "The duration in milliseconds that voice speech recognition remains active after you stop speaking. For example in a chat session, the transcribed text is submitted automatically after the timeout is met. Set to `0` to disable this feature."),
'type': 'number',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export class AccessibleNotificationService extends Disposable implements IAccess
this._events.set(AccessibleNotificationEvent.ChatRequestSent, { audioCue: AudioCue.chatRequestSent, alertMessage: localize('chatRequestSent', "Chat Request Sent"), alertSetting: AccessibilityAlertSettingId.ChatRequestSent });
this._events.set(AccessibleNotificationEvent.NotebookCellCompleted, { audioCue: AudioCue.notebookCellCompleted, alertMessage: localize('notebookCellCompleted', "Notebook Cell Completed"), alertSetting: AccessibilityAlertSettingId.NotebookCellCompleted });
this._events.set(AccessibleNotificationEvent.NotebookCellFailed, { audioCue: AudioCue.notebookCellFailed, alertMessage: localize('notebookCellFailed', "Notebook Cell Failed"), alertSetting: AccessibilityAlertSettingId.NotebookCellFailed });
this._events.set(AccessibleNotificationEvent.OnDebugBreak, { audioCue: AudioCue.onDebugBreak, alertMessage: localize('onDebugBreak', "On Debug Break"), alertSetting: AccessibilityAlertSettingId.OnDebugBreak });

this._register(this._workingCopyService.onDidSave((e) => this._notifyBasedOnUserGesture(AccessibleNotificationEvent.Save, e.reason === SaveReason.EXPLICIT)));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import { Disposable, IDisposable, toDisposable } from 'vs/base/common/lifecycle';
import { autorunWithStore, observableFromEvent } from 'vs/base/common/observable';
import { AccessibleNotificationEvent, IAccessibleNotificationService } from 'vs/platform/accessibility/common/accessibility';
import { IAudioCueService, AudioCue, AudioCueService } from 'vs/platform/audioCues/browser/audioCueService';
import { IWorkbenchContribution } from 'vs/workbench/common/contributions';
import { IDebugService, IDebugSession } from 'vs/workbench/contrib/debug/common/debug';
Expand All @@ -15,7 +16,8 @@ export class AudioCueLineDebuggerContribution

constructor(
@IDebugService debugService: IDebugService,
@IAudioCueService private readonly audioCueService: AudioCueService,
@IAudioCueService audioCueService: AudioCueService,
@IAccessibleNotificationService private readonly accessibleNotificationService: IAccessibleNotificationService
) {
super();

Expand Down Expand Up @@ -60,7 +62,7 @@ export class AudioCueLineDebuggerContribution
const stoppedDetails = session.getStoppedDetails();
const BREAKPOINT_STOP_REASON = 'breakpoint';
if (stoppedDetails && stoppedDetails.reason === BREAKPOINT_STOP_REASON) {
this.audioCueService.playAudioCue(AudioCue.onDebugBreak);
this.accessibleNotificationService.notify(AccessibleNotificationEvent.OnDebugBreak);
}
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import { EditorContextKeys } from 'vs/editor/common/editorContextKeys';
import { InlayHintItem, asCommandLink } from 'vs/editor/contrib/inlayHints/browser/inlayHints';
import { InlayHintsController } from 'vs/editor/contrib/inlayHints/browser/inlayHintsController';
import { localize } from 'vs/nls';
import { AccessibleNotificationEvent, IAccessibleNotificationService } from 'vs/platform/accessibility/common/accessibility';
import { registerAction2 } from 'vs/platform/actions/common/actions';
import { AudioCue, IAudioCueService } from 'vs/platform/audioCues/browser/audioCueService';
import { IContextKey, IContextKeyService, RawContextKey } from 'vs/platform/contextkey/common/contextkey';
import { IInstantiationService, ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry';
Expand All @@ -40,7 +40,7 @@ export class InlayHintsAccessibility implements IEditorContribution {
constructor(
private readonly _editor: ICodeEditor,
@IContextKeyService contextKeyService: IContextKeyService,
@IAudioCueService private readonly _audioCueService: IAudioCueService,
@IAccessibleNotificationService private readonly _accessibleNotificationService: IAccessibleNotificationService,
@IInstantiationService private readonly _instaService: IInstantiationService,
) {
this._ariaElement = document.createElement('span');
Expand Down Expand Up @@ -156,7 +156,7 @@ export class InlayHintsAccessibility implements IEditorContribution {
const line = this._editor.getPosition().lineNumber;
const hints = InlayHintsController.get(this._editor)?.getInlayHintsForLine(line);
if (!hints || hints.length === 0) {
this._audioCueService.playAudioCue(AudioCue.noInlayHints);
this._accessibleNotificationService.notify(AccessibleNotificationEvent.NoInlayHints);
} else {
this._read(line, hints);
}
Expand Down

0 comments on commit f39061c

Please sign in to comment.