@codingame/monaco-vscode-accessibility-service-override 4.5.2 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/accessibility.js +2 -2
- package/package.json +2 -2
- package/vscode/src/vs/platform/accessibilitySignal/browser/media/all.mp3.js +1 -1
- package/vscode/src/vs/workbench/contrib/accessibility/browser/accessibility.contribution.js +12 -4
- package/vscode/src/vs/workbench/contrib/accessibility/browser/audioCueConfiguration.js +231 -0
- package/vscode/src/vs/workbench/contrib/accessibilitySignals/browser/accessibilitySignal.contribution.js +13 -0
- package/vscode/src/vs/workbench/contrib/accessibilitySignals/browser/accessibilitySignalDebuggerContribution.js +52 -0
- package/vscode/src/vs/workbench/contrib/accessibilitySignals/browser/commands.js +152 -0
- package/vscode/src/vs/workbench/contrib/accessibilitySignals/browser/editorTextPropertySignalsContribution.js +244 -0
- package/vscode/src/vs/workbench/contrib/{accessibility → accessibilitySignals}/browser/openDiffEditorAnnouncement.js +1 -1
- package/vscode/src/vs/workbench/contrib/accessibilitySignals/browser/reloadableWorkbenchContribution.js +42 -0
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/accessibility/accessibility.js +7 -0
- package/vscode/src/vs/workbench/contrib/speech/browser/speechAccessibilitySignal.js +22 -0
- package/vscode/src/vs/workbench/contrib/accessibility/browser/accessibleView.js +0 -809
- /package/assets/{chatResponsePending.mp3 → progress.mp3} +0 -0
- /package/vscode/src/vs/workbench/contrib/{accessibility → accessibilitySignals}/browser/saveAccessibilitySignal.js +0 -0
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
|
|
2
|
+
import { disposableTimeout } from 'vscode/vscode/vs/base/common/async';
|
|
3
|
+
import { Disposable, DisposableStore } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
4
|
+
import 'vscode/vscode/vs/base/common/arrays';
|
|
5
|
+
import { derived } from 'vscode/vscode/vs/base/common/observableInternal/derived';
|
|
6
|
+
import { autorunWithStore, autorun } from 'vscode/vscode/vs/base/common/observableInternal/autorun';
|
|
7
|
+
import { observableFromValueWithChangeEvent, observableFromEvent, wasEventTriggeredRecently, observableSignalFromEvent, observableFromPromise } from 'vscode/vscode/vs/base/common/observableInternal/utils';
|
|
8
|
+
import 'vscode/vscode/vs/base/common/cancellation';
|
|
9
|
+
import { isDefined } from 'vscode/vscode/vs/base/common/types';
|
|
10
|
+
import { isDiffEditor, isCodeEditor } from 'vscode/vscode/vs/editor/browser/editorBrowser';
|
|
11
|
+
import { FoldingController } from 'vscode/vscode/vs/editor/contrib/folding/browser/folding';
|
|
12
|
+
import { AccessibilitySignal } from 'vscode/vscode/vs/platform/accessibilitySignal/browser/accessibilitySignalService';
|
|
13
|
+
import { IAccessibilitySignalService } from 'vscode/vscode/vs/platform/accessibilitySignal/browser/accessibilitySignalService.service';
|
|
14
|
+
import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
15
|
+
import { MarkerSeverity } from 'vscode/vscode/vs/platform/markers/common/markers';
|
|
16
|
+
import { IMarkerService } from 'vscode/vscode/vs/platform/markers/common/markers.service';
|
|
17
|
+
import { IDebugService } from 'vscode/vscode/vs/workbench/contrib/debug/common/debug.service';
|
|
18
|
+
import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService.service';
|
|
19
|
+
|
|
20
|
+
let EditorTextPropertySignalsContribution = class EditorTextPropertySignalsContribution extends Disposable {
|
|
21
|
+
constructor(_editorService, _instantiationService, _accessibilitySignalService) {
|
|
22
|
+
super();
|
|
23
|
+
this._editorService = _editorService;
|
|
24
|
+
this._instantiationService = _instantiationService;
|
|
25
|
+
this._accessibilitySignalService = _accessibilitySignalService;
|
|
26
|
+
this._textProperties = [
|
|
27
|
+
this._instantiationService.createInstance(MarkerTextProperty, AccessibilitySignal.errorAtPosition, AccessibilitySignal.errorOnLine, MarkerSeverity.Error),
|
|
28
|
+
this._instantiationService.createInstance(MarkerTextProperty, AccessibilitySignal.warningAtPosition, AccessibilitySignal.warningOnLine, MarkerSeverity.Warning),
|
|
29
|
+
this._instantiationService.createInstance(FoldedAreaTextProperty),
|
|
30
|
+
this._instantiationService.createInstance(BreakpointTextProperty),
|
|
31
|
+
];
|
|
32
|
+
this._someAccessibilitySignalIsEnabled = derived(this, reader => ( this._textProperties
|
|
33
|
+
.flatMap(p => [p.lineSignal, p.positionSignal])
|
|
34
|
+
.filter(isDefined)
|
|
35
|
+
.some(
|
|
36
|
+
signal => observableFromValueWithChangeEvent(this, this._accessibilitySignalService.getEnabledState(signal, false)).read(reader)
|
|
37
|
+
)));
|
|
38
|
+
this._activeEditorObservable = observableFromEvent(this._editorService.onDidActiveEditorChange, (_) => {
|
|
39
|
+
const activeTextEditorControl = this._editorService.activeTextEditorControl;
|
|
40
|
+
const editor = isDiffEditor(activeTextEditorControl)
|
|
41
|
+
? activeTextEditorControl.getOriginalEditor()
|
|
42
|
+
: isCodeEditor(activeTextEditorControl)
|
|
43
|
+
? activeTextEditorControl
|
|
44
|
+
: undefined;
|
|
45
|
+
return editor && editor.hasModel() ? { editor, model: editor.getModel() } : undefined;
|
|
46
|
+
});
|
|
47
|
+
this._register(autorunWithStore((reader, store) => {
|
|
48
|
+
if (!this._someAccessibilitySignalIsEnabled.read(reader)) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
const activeEditor = this._activeEditorObservable.read(reader);
|
|
52
|
+
if (activeEditor) {
|
|
53
|
+
this._registerAccessibilitySignalsForEditor(activeEditor.editor, activeEditor.model, store);
|
|
54
|
+
}
|
|
55
|
+
}));
|
|
56
|
+
}
|
|
57
|
+
_registerAccessibilitySignalsForEditor(editor, editorModel, store) {
|
|
58
|
+
let lastLine = -1;
|
|
59
|
+
const ignoredLineSignalsForCurrentLine = ( new Set());
|
|
60
|
+
const timeouts = ( new DisposableStore());
|
|
61
|
+
const propertySources = ( this._textProperties.map(p => ({ source: p.createSource(editor, editorModel), property: p })));
|
|
62
|
+
const didType = wasEventTriggeredRecently(editor.onDidChangeModelContent, 100, store);
|
|
63
|
+
store.add(editor.onDidChangeCursorPosition(args => {
|
|
64
|
+
timeouts.clear();
|
|
65
|
+
if (args &&
|
|
66
|
+
args.reason !== 3 &&
|
|
67
|
+
args.reason !== 0 ) {
|
|
68
|
+
ignoredLineSignalsForCurrentLine.clear();
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
const trigger = (property, source, mode) => {
|
|
72
|
+
const signal = mode === 'line' ? property.lineSignal : property.positionSignal;
|
|
73
|
+
if (!signal
|
|
74
|
+
|| !this._accessibilitySignalService.getEnabledState(signal, false).value
|
|
75
|
+
|| !source.isPresent(position, mode, undefined)) {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
for (const modality of ['sound', 'announcement']) {
|
|
79
|
+
if (this._accessibilitySignalService.getEnabledState(signal, false, modality)) {
|
|
80
|
+
const delay = this._getDelay(signal, modality) + (didType.get() ? 1000 : 0);
|
|
81
|
+
timeouts.add(disposableTimeout(() => {
|
|
82
|
+
if (source.isPresent(position, mode, undefined)) {
|
|
83
|
+
if (!(mode === 'line') || !( ignoredLineSignalsForCurrentLine.has(property))) {
|
|
84
|
+
this._accessibilitySignalService.playSignal(signal, { modality });
|
|
85
|
+
}
|
|
86
|
+
ignoredLineSignalsForCurrentLine.add(property);
|
|
87
|
+
}
|
|
88
|
+
}, delay));
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
const position = args.position;
|
|
93
|
+
const lineNumber = position.lineNumber;
|
|
94
|
+
if (lineNumber !== lastLine) {
|
|
95
|
+
ignoredLineSignalsForCurrentLine.clear();
|
|
96
|
+
lastLine = lineNumber;
|
|
97
|
+
for (const p of propertySources) {
|
|
98
|
+
trigger(p.property, p.source, 'line');
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
for (const p of propertySources) {
|
|
102
|
+
trigger(p.property, p.source, 'positional');
|
|
103
|
+
}
|
|
104
|
+
for (const s of propertySources) {
|
|
105
|
+
if (!( [s.property.lineSignal, s.property.positionSignal]
|
|
106
|
+
.some(s => s && this._accessibilitySignalService.getEnabledState(s, false).value))) {
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
let lastValueAtPosition = undefined;
|
|
110
|
+
let lastValueOnLine = undefined;
|
|
111
|
+
timeouts.add(autorun(reader => {
|
|
112
|
+
const newValueAtPosition = s.source.isPresentAtPosition(args.position, reader);
|
|
113
|
+
const newValueOnLine = s.source.isPresentOnLine(args.position.lineNumber, reader);
|
|
114
|
+
if (lastValueAtPosition !== undefined && lastValueAtPosition !== undefined) {
|
|
115
|
+
if (!lastValueAtPosition && newValueAtPosition) {
|
|
116
|
+
trigger(s.property, s.source, 'positional');
|
|
117
|
+
}
|
|
118
|
+
if (!lastValueOnLine && newValueOnLine) {
|
|
119
|
+
trigger(s.property, s.source, 'line');
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
lastValueAtPosition = newValueAtPosition;
|
|
123
|
+
lastValueOnLine = newValueOnLine;
|
|
124
|
+
}));
|
|
125
|
+
}
|
|
126
|
+
}));
|
|
127
|
+
}
|
|
128
|
+
_getDelay(signal, modality) {
|
|
129
|
+
if (signal === AccessibilitySignal.errorAtPosition || signal === AccessibilitySignal.warningAtPosition) {
|
|
130
|
+
if (modality === 'sound') {
|
|
131
|
+
return 100;
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
return 1000;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
if (modality === 'sound') {
|
|
138
|
+
return 400;
|
|
139
|
+
}
|
|
140
|
+
else {
|
|
141
|
+
return 3000;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
EditorTextPropertySignalsContribution = ( __decorate([
|
|
146
|
+
( __param(0, IEditorService)),
|
|
147
|
+
( __param(1, IInstantiationService)),
|
|
148
|
+
( __param(2, IAccessibilitySignalService))
|
|
149
|
+
], EditorTextPropertySignalsContribution));
|
|
150
|
+
class TextPropertySource {
|
|
151
|
+
static { this.notPresent = ( new TextPropertySource({ isPresentAtPosition: () => false, isPresentOnLine: () => false })); }
|
|
152
|
+
constructor(options) {
|
|
153
|
+
this.isPresentOnLine = options.isPresentOnLine;
|
|
154
|
+
this.isPresentAtPosition = options.isPresentAtPosition ?? (() => false);
|
|
155
|
+
}
|
|
156
|
+
isPresent(position, mode, reader) {
|
|
157
|
+
return mode === 'line' ? this.isPresentOnLine(position.lineNumber, reader) : this.isPresentAtPosition(position, reader);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
let MarkerTextProperty = class MarkerTextProperty {
|
|
161
|
+
constructor(positionSignal, lineSignal, severity, markerService) {
|
|
162
|
+
this.positionSignal = positionSignal;
|
|
163
|
+
this.lineSignal = lineSignal;
|
|
164
|
+
this.severity = severity;
|
|
165
|
+
this.markerService = markerService;
|
|
166
|
+
this.debounceWhileTyping = true;
|
|
167
|
+
}
|
|
168
|
+
createSource(editor, model) {
|
|
169
|
+
const obs = observableSignalFromEvent('onMarkerChanged', this.markerService.onMarkerChanged);
|
|
170
|
+
return ( new TextPropertySource({
|
|
171
|
+
isPresentAtPosition: (position, reader) => {
|
|
172
|
+
obs.read(reader);
|
|
173
|
+
const hasMarker = ( this.markerService
|
|
174
|
+
.read({ resource: model.uri })
|
|
175
|
+
.some((m) => m.severity === this.severity &&
|
|
176
|
+
m.startLineNumber <= position.lineNumber &&
|
|
177
|
+
position.lineNumber <= m.endLineNumber &&
|
|
178
|
+
m.startColumn <= position.column &&
|
|
179
|
+
position.column <= m.endColumn));
|
|
180
|
+
return hasMarker;
|
|
181
|
+
},
|
|
182
|
+
isPresentOnLine: (lineNumber, reader) => {
|
|
183
|
+
obs.read(reader);
|
|
184
|
+
const hasMarker = ( this.markerService
|
|
185
|
+
.read({ resource: model.uri })
|
|
186
|
+
.some((m) => m.severity === this.severity &&
|
|
187
|
+
m.startLineNumber <= lineNumber &&
|
|
188
|
+
lineNumber <= m.endLineNumber));
|
|
189
|
+
return hasMarker;
|
|
190
|
+
}
|
|
191
|
+
}));
|
|
192
|
+
}
|
|
193
|
+
};
|
|
194
|
+
MarkerTextProperty = ( __decorate([
|
|
195
|
+
( __param(3, IMarkerService))
|
|
196
|
+
], MarkerTextProperty));
|
|
197
|
+
class FoldedAreaTextProperty {
|
|
198
|
+
constructor() {
|
|
199
|
+
this.lineSignal = AccessibilitySignal.foldedArea;
|
|
200
|
+
}
|
|
201
|
+
createSource(editor, _model) {
|
|
202
|
+
const foldingController = FoldingController.get(editor);
|
|
203
|
+
if (!foldingController) {
|
|
204
|
+
return TextPropertySource.notPresent;
|
|
205
|
+
}
|
|
206
|
+
const foldingModel = observableFromPromise(foldingController.getFoldingModel() ?? Promise.resolve(undefined));
|
|
207
|
+
return ( new TextPropertySource({
|
|
208
|
+
isPresentOnLine(lineNumber, reader) {
|
|
209
|
+
const m = foldingModel.read(reader);
|
|
210
|
+
const regionAtLine = m.value?.getRegionAtLine(lineNumber);
|
|
211
|
+
const hasFolding = !regionAtLine
|
|
212
|
+
? false
|
|
213
|
+
: regionAtLine.isCollapsed &&
|
|
214
|
+
regionAtLine.startLineNumber === lineNumber;
|
|
215
|
+
return hasFolding;
|
|
216
|
+
}
|
|
217
|
+
}));
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
let BreakpointTextProperty = class BreakpointTextProperty {
|
|
221
|
+
constructor(debugService) {
|
|
222
|
+
this.debugService = debugService;
|
|
223
|
+
this.lineSignal = AccessibilitySignal.break;
|
|
224
|
+
}
|
|
225
|
+
createSource(editor, model) {
|
|
226
|
+
const signal = observableSignalFromEvent('onDidChangeBreakpoints', this.debugService.getModel().onDidChangeBreakpoints);
|
|
227
|
+
const debugService = this.debugService;
|
|
228
|
+
return ( new TextPropertySource({
|
|
229
|
+
isPresentOnLine(lineNumber, reader) {
|
|
230
|
+
signal.read(reader);
|
|
231
|
+
const breakpoints = debugService
|
|
232
|
+
.getModel()
|
|
233
|
+
.getBreakpoints({ uri: model.uri, lineNumber });
|
|
234
|
+
const hasBreakpoints = breakpoints.length > 0;
|
|
235
|
+
return hasBreakpoints;
|
|
236
|
+
}
|
|
237
|
+
}));
|
|
238
|
+
}
|
|
239
|
+
};
|
|
240
|
+
BreakpointTextProperty = ( __decorate([
|
|
241
|
+
( __param(0, IDebugService))
|
|
242
|
+
], BreakpointTextProperty));
|
|
243
|
+
|
|
244
|
+
export { EditorTextPropertySignalsContribution };
|
|
@@ -7,7 +7,7 @@ import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/c
|
|
|
7
7
|
import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService.service';
|
|
8
8
|
import { Event } from 'vscode/vscode/vs/base/common/event';
|
|
9
9
|
|
|
10
|
-
const _moduleId = "vs/workbench/contrib/
|
|
10
|
+
const _moduleId = "vs/workbench/contrib/accessibilitySignals/browser/openDiffEditorAnnouncement";
|
|
11
11
|
let DiffEditorActiveAnnouncementContribution = class DiffEditorActiveAnnouncementContribution extends Disposable {
|
|
12
12
|
static { this.ID = 'workbench.contrib.diffEditorActiveAnnouncement'; }
|
|
13
13
|
constructor(_editorService, _accessibilityService, _configurationService) {
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
|
|
2
|
+
import { isHotReloadEnabled } from 'vscode/vscode/vs/base/common/hotReload';
|
|
3
|
+
import 'vscode/vscode/vs/base/common/arrays';
|
|
4
|
+
import 'vscode/vscode/vs/base/common/observableInternal/derived';
|
|
5
|
+
import { autorunWithStore } from 'vscode/vscode/vs/base/common/observableInternal/autorun';
|
|
6
|
+
import 'vscode/vscode/vs/base/common/observableInternal/utils';
|
|
7
|
+
import 'vscode/vscode/vs/base/common/cancellation';
|
|
8
|
+
import { readHotReloadableExport } from 'vscode/vscode/vs/editor/browser/widget/diffEditor/utils';
|
|
9
|
+
import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
10
|
+
|
|
11
|
+
function wrapInReloadableClass(getClass) {
|
|
12
|
+
if (!isHotReloadEnabled()) {
|
|
13
|
+
return getClass();
|
|
14
|
+
}
|
|
15
|
+
return class ReloadableWrapper extends BaseClass {
|
|
16
|
+
constructor() {
|
|
17
|
+
super(...arguments);
|
|
18
|
+
this._autorun = undefined;
|
|
19
|
+
}
|
|
20
|
+
init() {
|
|
21
|
+
this._autorun = autorunWithStore((reader, store) => {
|
|
22
|
+
const clazz = readHotReloadableExport(getClass(), reader);
|
|
23
|
+
store.add(this.instantiationService.createInstance(clazz));
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
dispose() {
|
|
27
|
+
this._autorun?.dispose();
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
let BaseClass = class BaseClass {
|
|
32
|
+
constructor(instantiationService) {
|
|
33
|
+
this.instantiationService = instantiationService;
|
|
34
|
+
this.init();
|
|
35
|
+
}
|
|
36
|
+
init() { }
|
|
37
|
+
};
|
|
38
|
+
BaseClass = ( __decorate([
|
|
39
|
+
( __param(0, IInstantiationService))
|
|
40
|
+
], BaseClass));
|
|
41
|
+
|
|
42
|
+
export { wrapInReloadableClass };
|
|
@@ -13,6 +13,13 @@ class ToggleScreenReaderMode extends Action2 {
|
|
|
13
13
|
super({
|
|
14
14
|
id: 'editor.action.toggleScreenReaderAccessibilityMode',
|
|
15
15
|
title: ( localize2WithPath(_moduleId, 0, "Toggle Screen Reader Accessibility Mode")),
|
|
16
|
+
metadata: {
|
|
17
|
+
description: ( localize2WithPath(
|
|
18
|
+
_moduleId,
|
|
19
|
+
1,
|
|
20
|
+
"Toggles an optimized mode for usage with screen readers, braille devices, and other assistive technologies."
|
|
21
|
+
)),
|
|
22
|
+
},
|
|
16
23
|
f1: true,
|
|
17
24
|
keybinding: [{
|
|
18
25
|
primary: 2048 | 35 ,
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
|
|
2
|
+
import { Disposable } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
3
|
+
import { AccessibilitySignal } from 'vscode/vscode/vs/platform/accessibilitySignal/browser/accessibilitySignalService';
|
|
4
|
+
import { IAccessibilitySignalService } from 'vscode/vscode/vs/platform/accessibilitySignal/browser/accessibilitySignalService.service';
|
|
5
|
+
import { ISpeechService } from 'vscode/vscode/vs/workbench/contrib/speech/common/speechService.service';
|
|
6
|
+
|
|
7
|
+
let SpeechAccessibilitySignalContribution = class SpeechAccessibilitySignalContribution extends Disposable {
|
|
8
|
+
static { this.ID = 'workbench.contrib.speechAccessibilitySignal'; }
|
|
9
|
+
constructor(_accessibilitySignalService, _speechService) {
|
|
10
|
+
super();
|
|
11
|
+
this._accessibilitySignalService = _accessibilitySignalService;
|
|
12
|
+
this._speechService = _speechService;
|
|
13
|
+
this._register(this._speechService.onDidStartSpeechToTextSession(() => this._accessibilitySignalService.playSignal(AccessibilitySignal.voiceRecordingStarted)));
|
|
14
|
+
this._register(this._speechService.onDidEndSpeechToTextSession(() => this._accessibilitySignalService.playSignal(AccessibilitySignal.voiceRecordingStopped)));
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
SpeechAccessibilitySignalContribution = ( __decorate([
|
|
18
|
+
( __param(0, IAccessibilitySignalService)),
|
|
19
|
+
( __param(1, ISpeechService))
|
|
20
|
+
], SpeechAccessibilitySignalContribution));
|
|
21
|
+
|
|
22
|
+
export { SpeechAccessibilitySignalContribution };
|