@codingame/monaco-vscode-accessibility-service-override 4.5.1 → 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/accessibilityStatus.js +13 -32
- 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 +7 -10
- package/vscode/src/vs/workbench/contrib/accessibilitySignals/browser/reloadableWorkbenchContribution.js +42 -0
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/accessibility/accessibility.js +9 -5
- package/vscode/src/vs/workbench/contrib/speech/browser/speechAccessibilitySignal.js +22 -0
- package/vscode/src/vs/workbench/contrib/accessibility/browser/accessibleView.js +0 -880
- /package/assets/{chatResponsePending.mp3 → progress.mp3} +0 -0
- /package/vscode/src/vs/workbench/contrib/{accessibility → accessibilitySignals}/browser/saveAccessibilitySignal.js +0 -0
|
@@ -1,880 +0,0 @@
|
|
|
1
|
-
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
|
|
2
|
-
import { getActiveWindow, addDisposableListener, EventType, isActiveElement } from 'vscode/vscode/vs/base/browser/dom';
|
|
3
|
-
import { StandardKeyboardEvent } from 'vscode/vscode/vs/base/browser/keyboardEvent';
|
|
4
|
-
import { alert } from 'vscode/vscode/vs/base/browser/ui/aria/aria';
|
|
5
|
-
import { Codicon } from 'vscode/vscode/vs/base/common/codicons';
|
|
6
|
-
import { Disposable, DisposableStore } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
7
|
-
import marked_1 from 'vscode/external/vscode-marked/lib/marked.esm.js';
|
|
8
|
-
import { isMacintosh, isWindows } from 'vscode/vscode/vs/base/common/platform';
|
|
9
|
-
import { ThemeIcon } from 'vscode/vscode/vs/base/common/themables';
|
|
10
|
-
import { URI } from 'vscode/vscode/vs/base/common/uri';
|
|
11
|
-
import { EditorExtensionsRegistry } from 'vscode/vscode/vs/editor/browser/editorExtensions';
|
|
12
|
-
import { CodeEditorWidget } from 'vscode/vscode/vs/editor/browser/widget/codeEditor/codeEditorWidget';
|
|
13
|
-
import { Position } from 'vscode/vscode/vs/editor/common/core/position';
|
|
14
|
-
import { IModelService } from 'vscode/vscode/vs/editor/common/services/model';
|
|
15
|
-
import { AccessibilityHelpNLS } from 'vscode/vscode/vs/editor/common/standaloneStrings';
|
|
16
|
-
import { CodeActionController } from 'vscode/vscode/vs/editor/contrib/codeAction/browser/codeActionController';
|
|
17
|
-
import { localizeWithPath } from 'vscode/vscode/vs/nls';
|
|
18
|
-
import { IAccessibilityService } from 'vscode/vscode/vs/platform/accessibility/common/accessibility.service';
|
|
19
|
-
import { createAndFillInActionBarActions } from 'vscode/vscode/vs/platform/actions/browser/menuEntryActionViewItem';
|
|
20
|
-
import { WorkbenchToolBar } from 'vscode/vscode/vs/platform/actions/browser/toolbar';
|
|
21
|
-
import { MenuId } from 'vscode/vscode/vs/platform/actions/common/actions';
|
|
22
|
-
import { IMenuService } from 'vscode/vscode/vs/platform/actions/common/actions.service';
|
|
23
|
-
import { ICommandService } from 'vscode/vscode/vs/platform/commands/common/commands.service';
|
|
24
|
-
import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration.service';
|
|
25
|
-
import { IContextKeyService } from 'vscode/vscode/vs/platform/contextkey/common/contextkey.service';
|
|
26
|
-
import { IContextViewService } from 'vscode/vscode/vs/platform/contextview/browser/contextView.service';
|
|
27
|
-
import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
28
|
-
import { IKeybindingService } from 'vscode/vscode/vs/platform/keybinding/common/keybinding.service';
|
|
29
|
-
import { ILayoutService } from 'vscode/vscode/vs/platform/layout/browser/layoutService.service';
|
|
30
|
-
import { IOpenerService } from 'vscode/vscode/vs/platform/opener/common/opener.service';
|
|
31
|
-
import { IQuickInputService } from 'vscode/vscode/vs/platform/quickinput/common/quickInput.service';
|
|
32
|
-
import { accessibilityHelpIsShown, accessibleViewIsShown, accessibleViewSupportsNavigation, accessibleViewVerbosityEnabled, accessibleViewGoToSymbolSupported, accessibleViewCurrentProviderId, accessibleViewInCodeBlock, accessibleViewContainsCodeBlocks, accessibleViewOnLastLine } from 'vscode/vscode/vs/workbench/contrib/accessibility/browser/accessibilityConfiguration';
|
|
33
|
-
import { IChatCodeBlockContextProviderService } from 'vscode/vscode/vs/workbench/contrib/chat/browser/chat.service';
|
|
34
|
-
import { getSimpleEditorOptions } from 'vscode/vscode/vs/workbench/contrib/codeEditor/browser/simpleEditorOptions';
|
|
35
|
-
|
|
36
|
-
let AccessibleView = class AccessibleView extends Disposable {
|
|
37
|
-
get editorWidget() { return this._editorWidget; }
|
|
38
|
-
constructor(_openerService, _instantiationService, _configurationService, _modelService, _contextViewService, _contextKeyService, _accessibilityService, _keybindingService, _layoutService, _menuService, _commandService, _codeBlockContextProviderService) {
|
|
39
|
-
super();
|
|
40
|
-
this._openerService = _openerService;
|
|
41
|
-
this._instantiationService = _instantiationService;
|
|
42
|
-
this._configurationService = _configurationService;
|
|
43
|
-
this._modelService = _modelService;
|
|
44
|
-
this._contextViewService = _contextViewService;
|
|
45
|
-
this._contextKeyService = _contextKeyService;
|
|
46
|
-
this._accessibilityService = _accessibilityService;
|
|
47
|
-
this._keybindingService = _keybindingService;
|
|
48
|
-
this._layoutService = _layoutService;
|
|
49
|
-
this._menuService = _menuService;
|
|
50
|
-
this._commandService = _commandService;
|
|
51
|
-
this._codeBlockContextProviderService = _codeBlockContextProviderService;
|
|
52
|
-
this._accessiblityHelpIsShown = accessibilityHelpIsShown.bindTo(this._contextKeyService);
|
|
53
|
-
this._accessibleViewIsShown = accessibleViewIsShown.bindTo(this._contextKeyService);
|
|
54
|
-
this._accessibleViewSupportsNavigation = accessibleViewSupportsNavigation.bindTo(this._contextKeyService);
|
|
55
|
-
this._accessibleViewVerbosityEnabled = accessibleViewVerbosityEnabled.bindTo(this._contextKeyService);
|
|
56
|
-
this._accessibleViewGoToSymbolSupported = accessibleViewGoToSymbolSupported.bindTo(this._contextKeyService);
|
|
57
|
-
this._accessibleViewCurrentProviderId = accessibleViewCurrentProviderId.bindTo(this._contextKeyService);
|
|
58
|
-
this._accessibleViewInCodeBlock = accessibleViewInCodeBlock.bindTo(this._contextKeyService);
|
|
59
|
-
this._accessibleViewContainsCodeBlocks = accessibleViewContainsCodeBlocks.bindTo(this._contextKeyService);
|
|
60
|
-
this._onLastLine = accessibleViewOnLastLine.bindTo(this._contextKeyService);
|
|
61
|
-
this._container = document.createElement('div');
|
|
62
|
-
this._container.classList.add('accessible-view');
|
|
63
|
-
if (this._configurationService.getValue("accessibility.hideAccessibleView" )) {
|
|
64
|
-
this._container.classList.add('hide');
|
|
65
|
-
}
|
|
66
|
-
const codeEditorWidgetOptions = {
|
|
67
|
-
contributions: EditorExtensionsRegistry.getEditorContributions().filter(c => c.id !== CodeActionController.ID)
|
|
68
|
-
};
|
|
69
|
-
const titleBar = document.createElement('div');
|
|
70
|
-
titleBar.classList.add('accessible-view-title-bar');
|
|
71
|
-
this._title = document.createElement('div');
|
|
72
|
-
this._title.classList.add('accessible-view-title');
|
|
73
|
-
titleBar.appendChild(this._title);
|
|
74
|
-
const actionBar = document.createElement('div');
|
|
75
|
-
actionBar.classList.add('accessible-view-action-bar');
|
|
76
|
-
titleBar.appendChild(actionBar);
|
|
77
|
-
this._container.appendChild(titleBar);
|
|
78
|
-
this._toolbar = this._register(_instantiationService.createInstance(WorkbenchToolBar, actionBar, { orientation: 0 }));
|
|
79
|
-
this._toolbar.context = { viewId: 'accessibleView' };
|
|
80
|
-
const toolbarElt = this._toolbar.getElement();
|
|
81
|
-
toolbarElt.tabIndex = 0;
|
|
82
|
-
const editorOptions = {
|
|
83
|
-
...getSimpleEditorOptions(this._configurationService),
|
|
84
|
-
lineDecorationsWidth: 6,
|
|
85
|
-
dragAndDrop: false,
|
|
86
|
-
cursorWidth: 1,
|
|
87
|
-
wrappingStrategy: 'advanced',
|
|
88
|
-
wrappingIndent: 'none',
|
|
89
|
-
padding: { top: 2, bottom: 2 },
|
|
90
|
-
quickSuggestions: false,
|
|
91
|
-
renderWhitespace: 'none',
|
|
92
|
-
dropIntoEditor: { enabled: false },
|
|
93
|
-
readOnly: true,
|
|
94
|
-
fontFamily: 'var(--monaco-monospace-font)'
|
|
95
|
-
};
|
|
96
|
-
this._editorWidget = this._register(this._instantiationService.createInstance(CodeEditorWidget, this._container, editorOptions, codeEditorWidgetOptions));
|
|
97
|
-
this._register(this._accessibilityService.onDidChangeScreenReaderOptimized(() => {
|
|
98
|
-
if (this._currentProvider && this._accessiblityHelpIsShown.get()) {
|
|
99
|
-
this.show(this._currentProvider);
|
|
100
|
-
}
|
|
101
|
-
}));
|
|
102
|
-
this._register(this._configurationService.onDidChangeConfiguration(e => {
|
|
103
|
-
if (this._currentProvider && e.affectsConfiguration(this._currentProvider.verbositySettingKey)) {
|
|
104
|
-
if (this._accessiblityHelpIsShown.get()) {
|
|
105
|
-
this.show(this._currentProvider);
|
|
106
|
-
}
|
|
107
|
-
this._accessibleViewVerbosityEnabled.set(this._configurationService.getValue(this._currentProvider.verbositySettingKey));
|
|
108
|
-
this._updateToolbar(this._currentProvider.actions, this._currentProvider.options.type);
|
|
109
|
-
}
|
|
110
|
-
if (e.affectsConfiguration("accessibility.hideAccessibleView" )) {
|
|
111
|
-
this._container.classList.toggle('hide', this._configurationService.getValue("accessibility.hideAccessibleView" ));
|
|
112
|
-
}
|
|
113
|
-
}));
|
|
114
|
-
this._register(this._editorWidget.onDidDispose(() => this._resetContextKeys()));
|
|
115
|
-
this._register(this._editorWidget.onDidChangeCursorPosition(() => {
|
|
116
|
-
this._onLastLine.set(this._editorWidget.getPosition()?.lineNumber === this._editorWidget.getModel()?.getLineCount());
|
|
117
|
-
}));
|
|
118
|
-
this._register(this._editorWidget.onDidChangeCursorPosition(() => {
|
|
119
|
-
const cursorPosition = this._editorWidget.getPosition()?.lineNumber;
|
|
120
|
-
if (this._codeBlocks && cursorPosition !== undefined) {
|
|
121
|
-
const inCodeBlock = this._codeBlocks.find(c => c.startLine <= cursorPosition && c.endLine >= cursorPosition) !== undefined;
|
|
122
|
-
this._accessibleViewInCodeBlock.set(inCodeBlock);
|
|
123
|
-
}
|
|
124
|
-
}));
|
|
125
|
-
}
|
|
126
|
-
_resetContextKeys() {
|
|
127
|
-
this._accessiblityHelpIsShown.reset();
|
|
128
|
-
this._accessibleViewIsShown.reset();
|
|
129
|
-
this._accessibleViewSupportsNavigation.reset();
|
|
130
|
-
this._accessibleViewVerbosityEnabled.reset();
|
|
131
|
-
this._accessibleViewGoToSymbolSupported.reset();
|
|
132
|
-
this._accessibleViewCurrentProviderId.reset();
|
|
133
|
-
}
|
|
134
|
-
getPosition(id) {
|
|
135
|
-
if (!id || !this._lastProvider || this._lastProvider.id !== id) {
|
|
136
|
-
return undefined;
|
|
137
|
-
}
|
|
138
|
-
return this._editorWidget.getPosition() || undefined;
|
|
139
|
-
}
|
|
140
|
-
setPosition(position, reveal) {
|
|
141
|
-
this._editorWidget.setPosition(position);
|
|
142
|
-
if (reveal) {
|
|
143
|
-
this._editorWidget.revealPosition(position);
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
getCodeBlockContext() {
|
|
147
|
-
const position = this._editorWidget.getPosition();
|
|
148
|
-
if (!this._codeBlocks?.length || !position) {
|
|
149
|
-
return;
|
|
150
|
-
}
|
|
151
|
-
const codeBlockIndex = this._codeBlocks?.findIndex(c => c.startLine <= position?.lineNumber && c.endLine >= position?.lineNumber);
|
|
152
|
-
const codeBlock = codeBlockIndex !== undefined && codeBlockIndex > -1 ? this._codeBlocks[codeBlockIndex] : undefined;
|
|
153
|
-
if (!codeBlock || codeBlockIndex === undefined) {
|
|
154
|
-
return;
|
|
155
|
-
}
|
|
156
|
-
return { code: codeBlock.code, languageId: codeBlock.languageId, codeBlockIndex, element: undefined };
|
|
157
|
-
}
|
|
158
|
-
showLastProvider(id) {
|
|
159
|
-
if (!this._lastProvider || this._lastProvider.options.id !== id) {
|
|
160
|
-
return;
|
|
161
|
-
}
|
|
162
|
-
this.show(this._lastProvider);
|
|
163
|
-
}
|
|
164
|
-
show(provider, symbol, showAccessibleViewHelp, position) {
|
|
165
|
-
provider = provider ?? this._currentProvider;
|
|
166
|
-
if (!provider) {
|
|
167
|
-
return;
|
|
168
|
-
}
|
|
169
|
-
const delegate = {
|
|
170
|
-
getAnchor: () => { return { x: (getActiveWindow().innerWidth / 2) - ((Math.min(this._layoutService.activeContainerDimension.width * 0.62 , 600 )) / 2), y: this._layoutService.activeContainerOffset.quickPickTop }; },
|
|
171
|
-
render: (container) => {
|
|
172
|
-
container.classList.add('accessible-view-container');
|
|
173
|
-
return this._render(provider, container, showAccessibleViewHelp);
|
|
174
|
-
},
|
|
175
|
-
onHide: () => {
|
|
176
|
-
if (!showAccessibleViewHelp) {
|
|
177
|
-
this._updateLastProvider();
|
|
178
|
-
this._currentProvider = undefined;
|
|
179
|
-
this._resetContextKeys();
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
};
|
|
183
|
-
this._contextViewService.showContextView(delegate);
|
|
184
|
-
if (position) {
|
|
185
|
-
setTimeout(() => {
|
|
186
|
-
this._editorWidget.revealLine(position.lineNumber);
|
|
187
|
-
this._editorWidget.setSelection({ startLineNumber: position.lineNumber, startColumn: position.column, endLineNumber: position.lineNumber, endColumn: position.column });
|
|
188
|
-
}, 10);
|
|
189
|
-
}
|
|
190
|
-
if (symbol && this._currentProvider) {
|
|
191
|
-
this.showSymbol(this._currentProvider, symbol);
|
|
192
|
-
}
|
|
193
|
-
if (provider.onDidRequestClearLastProvider) {
|
|
194
|
-
this._register(provider.onDidRequestClearLastProvider((id) => {
|
|
195
|
-
if (this._lastProvider?.options.id === id) {
|
|
196
|
-
this._lastProvider = undefined;
|
|
197
|
-
}
|
|
198
|
-
}));
|
|
199
|
-
}
|
|
200
|
-
if (provider.options.id) {
|
|
201
|
-
this._lastProvider = provider;
|
|
202
|
-
}
|
|
203
|
-
if (provider.id === "panelChat" ) {
|
|
204
|
-
this._register(this._codeBlockContextProviderService.registerProvider({ getCodeBlockContext: () => this.getCodeBlockContext() }, 'accessibleView'));
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
previous() {
|
|
208
|
-
if (!this._currentProvider) {
|
|
209
|
-
return;
|
|
210
|
-
}
|
|
211
|
-
this._currentProvider.previous?.();
|
|
212
|
-
}
|
|
213
|
-
next() {
|
|
214
|
-
if (!this._currentProvider) {
|
|
215
|
-
return;
|
|
216
|
-
}
|
|
217
|
-
this._currentProvider.next?.();
|
|
218
|
-
}
|
|
219
|
-
goToSymbol() {
|
|
220
|
-
if (!this._currentProvider) {
|
|
221
|
-
return;
|
|
222
|
-
}
|
|
223
|
-
this._instantiationService.createInstance(AccessibleViewSymbolQuickPick, this).show(this._currentProvider);
|
|
224
|
-
}
|
|
225
|
-
calculateCodeBlocks(markdown) {
|
|
226
|
-
if (this._currentProvider?.id !== "panelChat" ) {
|
|
227
|
-
return;
|
|
228
|
-
}
|
|
229
|
-
if (this._currentProvider.options.language && this._currentProvider.options.language !== 'markdown') {
|
|
230
|
-
return;
|
|
231
|
-
}
|
|
232
|
-
const lines = markdown.split('\n');
|
|
233
|
-
this._codeBlocks = [];
|
|
234
|
-
let inBlock = false;
|
|
235
|
-
let startLine = 0;
|
|
236
|
-
let languageId;
|
|
237
|
-
lines.forEach((line, i) => {
|
|
238
|
-
if (!inBlock && line.startsWith('```')) {
|
|
239
|
-
inBlock = true;
|
|
240
|
-
startLine = i + 1;
|
|
241
|
-
languageId = line.substring(3).trim();
|
|
242
|
-
}
|
|
243
|
-
else if (inBlock && line.startsWith('```')) {
|
|
244
|
-
inBlock = false;
|
|
245
|
-
const endLine = i;
|
|
246
|
-
const code = lines.slice(startLine, endLine).join('\n');
|
|
247
|
-
this._codeBlocks?.push({ startLine, endLine, code, languageId });
|
|
248
|
-
}
|
|
249
|
-
});
|
|
250
|
-
this._accessibleViewContainsCodeBlocks.set(this._codeBlocks.length > 0);
|
|
251
|
-
}
|
|
252
|
-
getSymbols() {
|
|
253
|
-
if (!this._currentProvider || !this._currentContent) {
|
|
254
|
-
return;
|
|
255
|
-
}
|
|
256
|
-
const symbols = this._currentProvider.getSymbols?.() || [];
|
|
257
|
-
if (symbols?.length) {
|
|
258
|
-
return symbols;
|
|
259
|
-
}
|
|
260
|
-
if (this._currentProvider.options.language && this._currentProvider.options.language !== 'markdown') {
|
|
261
|
-
return;
|
|
262
|
-
}
|
|
263
|
-
const markdownTokens = marked_1.lexer(this._currentContent);
|
|
264
|
-
if (!markdownTokens) {
|
|
265
|
-
return;
|
|
266
|
-
}
|
|
267
|
-
this._convertTokensToSymbols(markdownTokens, symbols);
|
|
268
|
-
return symbols.length ? symbols : undefined;
|
|
269
|
-
}
|
|
270
|
-
_convertTokensToSymbols(tokens, symbols) {
|
|
271
|
-
let firstListItem;
|
|
272
|
-
for (const token of tokens) {
|
|
273
|
-
let label = undefined;
|
|
274
|
-
if ('type' in token) {
|
|
275
|
-
switch (token.type) {
|
|
276
|
-
case 'heading':
|
|
277
|
-
case 'paragraph':
|
|
278
|
-
case 'code':
|
|
279
|
-
label = token.text;
|
|
280
|
-
break;
|
|
281
|
-
case 'list': {
|
|
282
|
-
const firstItem = token.items?.[0];
|
|
283
|
-
if (!firstItem) {
|
|
284
|
-
break;
|
|
285
|
-
}
|
|
286
|
-
firstListItem = `- ${firstItem.text}`;
|
|
287
|
-
label = token.items?.map(i => i.text).join(', ');
|
|
288
|
-
break;
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
if (label) {
|
|
293
|
-
symbols.push({ markdownToParse: label, label: ( localizeWithPath(
|
|
294
|
-
'vs/workbench/contrib/accessibility/browser/accessibleView',
|
|
295
|
-
'symbolLabel',
|
|
296
|
-
"({0}) {1}",
|
|
297
|
-
token.type,
|
|
298
|
-
label
|
|
299
|
-
)), ariaLabel: ( localizeWithPath(
|
|
300
|
-
'vs/workbench/contrib/accessibility/browser/accessibleView',
|
|
301
|
-
'symbolLabelAria',
|
|
302
|
-
"({0}) {1}",
|
|
303
|
-
token.type,
|
|
304
|
-
label
|
|
305
|
-
)), firstListItem });
|
|
306
|
-
firstListItem = undefined;
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
}
|
|
310
|
-
showSymbol(provider, symbol) {
|
|
311
|
-
if (!this._currentContent) {
|
|
312
|
-
return;
|
|
313
|
-
}
|
|
314
|
-
let lineNumber = symbol.lineNumber;
|
|
315
|
-
const markdownToParse = symbol.markdownToParse;
|
|
316
|
-
if (lineNumber === undefined && markdownToParse === undefined) {
|
|
317
|
-
return;
|
|
318
|
-
}
|
|
319
|
-
if (lineNumber === undefined && markdownToParse) {
|
|
320
|
-
const index = this._currentContent.split('\n').findIndex(line => line.includes(markdownToParse.split('\n')[0]) || (symbol.firstListItem && line.includes(symbol.firstListItem))) ?? -1;
|
|
321
|
-
if (index >= 0) {
|
|
322
|
-
lineNumber = index + 1;
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
|
-
if (lineNumber === undefined) {
|
|
326
|
-
return;
|
|
327
|
-
}
|
|
328
|
-
this.show(provider, undefined, undefined, { lineNumber, column: 1 });
|
|
329
|
-
this._updateContextKeys(provider, true);
|
|
330
|
-
}
|
|
331
|
-
disableHint() {
|
|
332
|
-
if (!this._currentProvider) {
|
|
333
|
-
return;
|
|
334
|
-
}
|
|
335
|
-
this._configurationService.updateValue(this._currentProvider?.verbositySettingKey, false);
|
|
336
|
-
alert(( localizeWithPath(
|
|
337
|
-
'vs/workbench/contrib/accessibility/browser/accessibleView',
|
|
338
|
-
'disableAccessibilityHelp',
|
|
339
|
-
'{0} accessibility verbosity is now disabled',
|
|
340
|
-
this._currentProvider.verbositySettingKey
|
|
341
|
-
)));
|
|
342
|
-
}
|
|
343
|
-
_updateContextKeys(provider, shown) {
|
|
344
|
-
if (provider.options.type === "help" ) {
|
|
345
|
-
this._accessiblityHelpIsShown.set(shown);
|
|
346
|
-
this._accessibleViewIsShown.reset();
|
|
347
|
-
}
|
|
348
|
-
else {
|
|
349
|
-
this._accessibleViewIsShown.set(shown);
|
|
350
|
-
this._accessiblityHelpIsShown.reset();
|
|
351
|
-
}
|
|
352
|
-
if (provider.next && provider.previous) {
|
|
353
|
-
this._accessibleViewSupportsNavigation.set(true);
|
|
354
|
-
}
|
|
355
|
-
else {
|
|
356
|
-
this._accessibleViewSupportsNavigation.reset();
|
|
357
|
-
}
|
|
358
|
-
const verbosityEnabled = this._configurationService.getValue(provider.verbositySettingKey);
|
|
359
|
-
this._accessibleViewVerbosityEnabled.set(verbosityEnabled);
|
|
360
|
-
this._accessibleViewGoToSymbolSupported.set(this._goToSymbolsSupported() ? this.getSymbols()?.length > 0 : false);
|
|
361
|
-
}
|
|
362
|
-
_render(provider, container, showAccessibleViewHelp) {
|
|
363
|
-
this._currentProvider = provider;
|
|
364
|
-
this._accessibleViewCurrentProviderId.set(provider.id);
|
|
365
|
-
const value = this._configurationService.getValue(provider.verbositySettingKey);
|
|
366
|
-
const readMoreLink = provider.options.readMoreUrl ? ( localizeWithPath(
|
|
367
|
-
'vs/workbench/contrib/accessibility/browser/accessibleView',
|
|
368
|
-
"openDoc",
|
|
369
|
-
"\n\nOpen a browser window with more information related to accessibility (H)."
|
|
370
|
-
)) : '';
|
|
371
|
-
let disableHelpHint = '';
|
|
372
|
-
if (provider.options.type === "help" && !!value) {
|
|
373
|
-
disableHelpHint = this._getDisableVerbosityHint(provider.verbositySettingKey);
|
|
374
|
-
}
|
|
375
|
-
const accessibilitySupport = this._accessibilityService.isScreenReaderOptimized();
|
|
376
|
-
let message = '';
|
|
377
|
-
if (provider.options.type === "help" ) {
|
|
378
|
-
const turnOnMessage = (isMacintosh
|
|
379
|
-
? AccessibilityHelpNLS.changeConfigToOnMac
|
|
380
|
-
: AccessibilityHelpNLS.changeConfigToOnWinLinux);
|
|
381
|
-
if (accessibilitySupport && provider.verbositySettingKey === "accessibility.verbosity.editor" ) {
|
|
382
|
-
message = AccessibilityHelpNLS.auto_on;
|
|
383
|
-
message += '\n';
|
|
384
|
-
}
|
|
385
|
-
else if (!accessibilitySupport) {
|
|
386
|
-
message = AccessibilityHelpNLS.auto_off + '\n' + turnOnMessage;
|
|
387
|
-
message += '\n';
|
|
388
|
-
}
|
|
389
|
-
}
|
|
390
|
-
const verbose = this._configurationService.getValue(provider.verbositySettingKey);
|
|
391
|
-
const exitThisDialogHint = verbose && !provider.options.position ? ( localizeWithPath(
|
|
392
|
-
'vs/workbench/contrib/accessibility/browser/accessibleView',
|
|
393
|
-
'exit',
|
|
394
|
-
'\n\nExit this dialog (Escape).'
|
|
395
|
-
)) : '';
|
|
396
|
-
const newContent = message + provider.provideContent() + readMoreLink + disableHelpHint + exitThisDialogHint;
|
|
397
|
-
this.calculateCodeBlocks(newContent);
|
|
398
|
-
this._currentContent = newContent;
|
|
399
|
-
this._updateContextKeys(provider, true);
|
|
400
|
-
const widgetIsFocused = this._editorWidget.hasTextFocus() || this._editorWidget.hasWidgetFocus();
|
|
401
|
-
this._getTextModel(( URI.from(
|
|
402
|
-
{ path: `accessible-view-${provider.verbositySettingKey}`, scheme: 'accessible-view', fragment: this._currentContent }
|
|
403
|
-
))).then((model) => {
|
|
404
|
-
if (!model) {
|
|
405
|
-
return;
|
|
406
|
-
}
|
|
407
|
-
this._editorWidget.setModel(model);
|
|
408
|
-
const domNode = this._editorWidget.getDomNode();
|
|
409
|
-
if (!domNode) {
|
|
410
|
-
return;
|
|
411
|
-
}
|
|
412
|
-
model.setLanguage(provider.options.language ?? 'markdown');
|
|
413
|
-
container.appendChild(this._container);
|
|
414
|
-
let actionsHint = '';
|
|
415
|
-
const verbose = this._configurationService.getValue(provider.verbositySettingKey);
|
|
416
|
-
const hasActions = this._accessibleViewSupportsNavigation.get() || this._accessibleViewVerbosityEnabled.get() || this._accessibleViewGoToSymbolSupported.get() || this._currentProvider?.actions;
|
|
417
|
-
if (verbose && !showAccessibleViewHelp && hasActions) {
|
|
418
|
-
actionsHint = provider.options.position ? ( localizeWithPath(
|
|
419
|
-
'vs/workbench/contrib/accessibility/browser/accessibleView',
|
|
420
|
-
'ariaAccessibleViewActionsBottom',
|
|
421
|
-
'Explore actions such as disabling this hint (Shift+Tab), use Escape to exit this dialog.'
|
|
422
|
-
)) : ( localizeWithPath(
|
|
423
|
-
'vs/workbench/contrib/accessibility/browser/accessibleView',
|
|
424
|
-
'ariaAccessibleViewActions',
|
|
425
|
-
'Explore actions such as disabling this hint (Shift+Tab).'
|
|
426
|
-
));
|
|
427
|
-
}
|
|
428
|
-
let ariaLabel = provider.options.type === "help" ? ( localizeWithPath(
|
|
429
|
-
'vs/workbench/contrib/accessibility/browser/accessibleView',
|
|
430
|
-
'accessibility-help',
|
|
431
|
-
"Accessibility Help"
|
|
432
|
-
)) : ( localizeWithPath(
|
|
433
|
-
'vs/workbench/contrib/accessibility/browser/accessibleView',
|
|
434
|
-
'accessible-view',
|
|
435
|
-
"Accessible View"
|
|
436
|
-
));
|
|
437
|
-
this._title.textContent = ariaLabel;
|
|
438
|
-
if (actionsHint && provider.options.type === "view" ) {
|
|
439
|
-
ariaLabel = ( localizeWithPath(
|
|
440
|
-
'vs/workbench/contrib/accessibility/browser/accessibleView',
|
|
441
|
-
'accessible-view-hint',
|
|
442
|
-
"Accessible View, {0}",
|
|
443
|
-
actionsHint
|
|
444
|
-
));
|
|
445
|
-
}
|
|
446
|
-
else if (actionsHint) {
|
|
447
|
-
ariaLabel = ( localizeWithPath(
|
|
448
|
-
'vs/workbench/contrib/accessibility/browser/accessibleView',
|
|
449
|
-
'accessibility-help-hint',
|
|
450
|
-
"Accessibility Help, {0}",
|
|
451
|
-
actionsHint
|
|
452
|
-
));
|
|
453
|
-
}
|
|
454
|
-
if (isWindows && widgetIsFocused) {
|
|
455
|
-
ariaLabel = '';
|
|
456
|
-
}
|
|
457
|
-
this._editorWidget.updateOptions({ ariaLabel });
|
|
458
|
-
this._editorWidget.focus();
|
|
459
|
-
if (this._currentProvider?.options.position) {
|
|
460
|
-
const position = this._editorWidget.getPosition();
|
|
461
|
-
const isDefaultPosition = position?.lineNumber === 1 && position.column === 1;
|
|
462
|
-
if (this._currentProvider.options.position === 'bottom' || this._currentProvider.options.position === 'initial-bottom' && isDefaultPosition) {
|
|
463
|
-
const lastLine = this.editorWidget.getModel()?.getLineCount();
|
|
464
|
-
const position = lastLine !== undefined && lastLine > 0 ? ( new Position(lastLine, 1)) : undefined;
|
|
465
|
-
if (position) {
|
|
466
|
-
this._editorWidget.setPosition(position);
|
|
467
|
-
this._editorWidget.revealLine(position.lineNumber);
|
|
468
|
-
}
|
|
469
|
-
}
|
|
470
|
-
}
|
|
471
|
-
});
|
|
472
|
-
this._updateToolbar(provider.actions, provider.options.type);
|
|
473
|
-
const hide = (e) => {
|
|
474
|
-
provider.onClose();
|
|
475
|
-
e.stopPropagation();
|
|
476
|
-
this._contextViewService.hideContextView();
|
|
477
|
-
this._updateContextKeys(provider, false);
|
|
478
|
-
this._lastProvider = undefined;
|
|
479
|
-
this._currentContent = undefined;
|
|
480
|
-
};
|
|
481
|
-
const disposableStore = ( new DisposableStore());
|
|
482
|
-
disposableStore.add(this._editorWidget.onKeyDown((e) => {
|
|
483
|
-
if (e.keyCode === 3 ) {
|
|
484
|
-
this._commandService.executeCommand('editor.action.openLink');
|
|
485
|
-
}
|
|
486
|
-
else if (e.keyCode === 9 || shouldHide(e.browserEvent, this._keybindingService, this._configurationService)) {
|
|
487
|
-
hide(e);
|
|
488
|
-
}
|
|
489
|
-
else if (e.keyCode === 38 && provider.options.readMoreUrl) {
|
|
490
|
-
const url = provider.options.readMoreUrl;
|
|
491
|
-
alert(AccessibilityHelpNLS.openingDocs);
|
|
492
|
-
this._openerService.open(( URI.parse(url)));
|
|
493
|
-
e.preventDefault();
|
|
494
|
-
e.stopPropagation();
|
|
495
|
-
}
|
|
496
|
-
provider.onKeyDown?.(e);
|
|
497
|
-
}));
|
|
498
|
-
disposableStore.add(addDisposableListener(this._toolbar.getElement(), EventType.KEY_DOWN, (e) => {
|
|
499
|
-
const keyboardEvent = ( new StandardKeyboardEvent(e));
|
|
500
|
-
if (keyboardEvent.equals(9 )) {
|
|
501
|
-
hide(e);
|
|
502
|
-
}
|
|
503
|
-
}));
|
|
504
|
-
disposableStore.add(this._editorWidget.onDidBlurEditorWidget(() => {
|
|
505
|
-
if (!isActiveElement(this._toolbar.getElement())) {
|
|
506
|
-
this._contextViewService.hideContextView();
|
|
507
|
-
}
|
|
508
|
-
}));
|
|
509
|
-
disposableStore.add(this._editorWidget.onDidContentSizeChange(() => this._layout()));
|
|
510
|
-
disposableStore.add(this._layoutService.onDidLayoutActiveContainer(() => this._layout()));
|
|
511
|
-
return disposableStore;
|
|
512
|
-
}
|
|
513
|
-
_updateToolbar(providedActions, type) {
|
|
514
|
-
this._toolbar.setAriaLabel(type === "help" ? ( localizeWithPath(
|
|
515
|
-
'vs/workbench/contrib/accessibility/browser/accessibleView',
|
|
516
|
-
'accessibleHelpToolbar',
|
|
517
|
-
'Accessibility Help'
|
|
518
|
-
)) : ( localizeWithPath(
|
|
519
|
-
'vs/workbench/contrib/accessibility/browser/accessibleView',
|
|
520
|
-
'accessibleViewToolbar',
|
|
521
|
-
"Accessible View"
|
|
522
|
-
)));
|
|
523
|
-
const menuActions = [];
|
|
524
|
-
const toolbarMenu = this._register(this._menuService.createMenu(MenuId.AccessibleView, this._contextKeyService));
|
|
525
|
-
createAndFillInActionBarActions(toolbarMenu, {}, menuActions);
|
|
526
|
-
if (providedActions) {
|
|
527
|
-
for (const providedAction of providedActions) {
|
|
528
|
-
providedAction.class = providedAction.class || ThemeIcon.asClassName(Codicon.primitiveSquare);
|
|
529
|
-
providedAction.checked = undefined;
|
|
530
|
-
}
|
|
531
|
-
this._toolbar.setActions([...providedActions, ...menuActions]);
|
|
532
|
-
}
|
|
533
|
-
else {
|
|
534
|
-
this._toolbar.setActions(menuActions);
|
|
535
|
-
}
|
|
536
|
-
}
|
|
537
|
-
_layout() {
|
|
538
|
-
const dimension = this._layoutService.activeContainerDimension;
|
|
539
|
-
const maxHeight = dimension.height && dimension.height * .4;
|
|
540
|
-
const height = Math.min(maxHeight, this._editorWidget.getContentHeight());
|
|
541
|
-
const width = Math.min(dimension.width * 0.62 , 600 );
|
|
542
|
-
this._editorWidget.layout({ width, height });
|
|
543
|
-
}
|
|
544
|
-
async _getTextModel(resource) {
|
|
545
|
-
const existing = this._modelService.getModel(resource);
|
|
546
|
-
if (existing && !existing.isDisposed()) {
|
|
547
|
-
return existing;
|
|
548
|
-
}
|
|
549
|
-
return this._modelService.createModel(resource.fragment, null, resource, false);
|
|
550
|
-
}
|
|
551
|
-
_goToSymbolsSupported() {
|
|
552
|
-
if (!this._currentProvider) {
|
|
553
|
-
return false;
|
|
554
|
-
}
|
|
555
|
-
return this._currentProvider.options.type === "help" || this._currentProvider.options.language === 'markdown' || this._currentProvider.options.language === undefined || !!this._currentProvider.getSymbols?.();
|
|
556
|
-
}
|
|
557
|
-
_updateLastProvider() {
|
|
558
|
-
if (!this._currentProvider) {
|
|
559
|
-
return;
|
|
560
|
-
}
|
|
561
|
-
const lastProvider = Object.assign({}, this._currentProvider);
|
|
562
|
-
lastProvider.provideContent = this._currentProvider.provideContent.bind(lastProvider);
|
|
563
|
-
lastProvider.options = Object.assign({}, this._currentProvider.options);
|
|
564
|
-
lastProvider.verbositySettingKey = this._currentProvider.verbositySettingKey;
|
|
565
|
-
return lastProvider;
|
|
566
|
-
}
|
|
567
|
-
showAccessibleViewHelp() {
|
|
568
|
-
const lastProvider = this._updateLastProvider();
|
|
569
|
-
if (!lastProvider) {
|
|
570
|
-
return;
|
|
571
|
-
}
|
|
572
|
-
const accessibleViewHelpProvider = {
|
|
573
|
-
id: lastProvider.id,
|
|
574
|
-
provideContent: () => lastProvider.options.customHelp ? lastProvider?.options.customHelp() : this._getAccessibleViewHelpDialogContent(this._goToSymbolsSupported()),
|
|
575
|
-
onClose: () => this.show(lastProvider),
|
|
576
|
-
options: { type: "help" },
|
|
577
|
-
verbositySettingKey: lastProvider.verbositySettingKey
|
|
578
|
-
};
|
|
579
|
-
this._contextViewService.hideContextView();
|
|
580
|
-
setTimeout(() => this.show(accessibleViewHelpProvider, undefined, true), 100);
|
|
581
|
-
}
|
|
582
|
-
_getAccessibleViewHelpDialogContent(providerHasSymbols) {
|
|
583
|
-
const navigationHint = this._getNavigationHint();
|
|
584
|
-
const goToSymbolHint = this._getGoToSymbolHint(providerHasSymbols);
|
|
585
|
-
const toolbarHint = ( localizeWithPath(
|
|
586
|
-
'vs/workbench/contrib/accessibility/browser/accessibleView',
|
|
587
|
-
'toolbar',
|
|
588
|
-
"Navigate to the toolbar (Shift+Tab)."
|
|
589
|
-
));
|
|
590
|
-
const chatHints = this._getChatHints();
|
|
591
|
-
let hint = ( localizeWithPath(
|
|
592
|
-
'vs/workbench/contrib/accessibility/browser/accessibleView',
|
|
593
|
-
'intro',
|
|
594
|
-
"In the accessible view, you can:\n"
|
|
595
|
-
));
|
|
596
|
-
if (navigationHint) {
|
|
597
|
-
hint += ' - ' + navigationHint + '\n';
|
|
598
|
-
}
|
|
599
|
-
if (goToSymbolHint) {
|
|
600
|
-
hint += ' - ' + goToSymbolHint + '\n';
|
|
601
|
-
}
|
|
602
|
-
if (toolbarHint) {
|
|
603
|
-
hint += ' - ' + toolbarHint + '\n';
|
|
604
|
-
}
|
|
605
|
-
if (chatHints) {
|
|
606
|
-
hint += chatHints;
|
|
607
|
-
}
|
|
608
|
-
return hint;
|
|
609
|
-
}
|
|
610
|
-
_getChatHints() {
|
|
611
|
-
if (this._currentProvider?.id !== "panelChat" ) {
|
|
612
|
-
return;
|
|
613
|
-
}
|
|
614
|
-
let hint = '';
|
|
615
|
-
const insertAtCursorKb = this._keybindingService.lookupKeybinding('workbench.action.chat.insertCodeBlock')?.getAriaLabel();
|
|
616
|
-
const insertIntoNewFileKb = this._keybindingService.lookupKeybinding('workbench.action.chat.insertIntoNewFile')?.getAriaLabel();
|
|
617
|
-
const runInTerminalKb = this._keybindingService.lookupKeybinding('workbench.action.chat.runInTerminal')?.getAriaLabel();
|
|
618
|
-
if (insertAtCursorKb) {
|
|
619
|
-
hint += ( localizeWithPath(
|
|
620
|
-
'vs/workbench/contrib/accessibility/browser/accessibleView',
|
|
621
|
-
'insertAtCursor',
|
|
622
|
-
" - Insert the code block at the cursor ({0}).\n",
|
|
623
|
-
insertAtCursorKb
|
|
624
|
-
));
|
|
625
|
-
}
|
|
626
|
-
else {
|
|
627
|
-
hint += ( localizeWithPath(
|
|
628
|
-
'vs/workbench/contrib/accessibility/browser/accessibleView',
|
|
629
|
-
'insertAtCursorNoKb',
|
|
630
|
-
" - Insert the code block at the cursor by configuring a keybinding for the Chat: Insert Code Block command.\n"
|
|
631
|
-
));
|
|
632
|
-
}
|
|
633
|
-
if (insertIntoNewFileKb) {
|
|
634
|
-
hint += ( localizeWithPath(
|
|
635
|
-
'vs/workbench/contrib/accessibility/browser/accessibleView',
|
|
636
|
-
'insertIntoNewFile',
|
|
637
|
-
" - Insert the code block into a new file ({0}).\n",
|
|
638
|
-
insertIntoNewFileKb
|
|
639
|
-
));
|
|
640
|
-
}
|
|
641
|
-
else {
|
|
642
|
-
hint += ( localizeWithPath(
|
|
643
|
-
'vs/workbench/contrib/accessibility/browser/accessibleView',
|
|
644
|
-
'insertIntoNewFileNoKb',
|
|
645
|
-
" - Insert the code block into a new file by configuring a keybinding for the Chat: Insert into New File command.\n"
|
|
646
|
-
));
|
|
647
|
-
}
|
|
648
|
-
if (runInTerminalKb) {
|
|
649
|
-
hint += ( localizeWithPath(
|
|
650
|
-
'vs/workbench/contrib/accessibility/browser/accessibleView',
|
|
651
|
-
'runInTerminal',
|
|
652
|
-
" - Run the code block in the terminal ({0}).\n",
|
|
653
|
-
runInTerminalKb
|
|
654
|
-
));
|
|
655
|
-
}
|
|
656
|
-
else {
|
|
657
|
-
hint += ( localizeWithPath(
|
|
658
|
-
'vs/workbench/contrib/accessibility/browser/accessibleView',
|
|
659
|
-
'runInTerminalNoKb',
|
|
660
|
-
" - Run the coe block in the terminal by configuring a keybinding for the Chat: Insert into Terminal command.\n"
|
|
661
|
-
));
|
|
662
|
-
}
|
|
663
|
-
return hint;
|
|
664
|
-
}
|
|
665
|
-
_getNavigationHint() {
|
|
666
|
-
let hint = '';
|
|
667
|
-
const nextKeybinding = this._keybindingService.lookupKeybinding("editor.action.accessibleViewNext" )?.getAriaLabel();
|
|
668
|
-
const previousKeybinding = this._keybindingService.lookupKeybinding("editor.action.accessibleViewPrevious" )?.getAriaLabel();
|
|
669
|
-
if (nextKeybinding && previousKeybinding) {
|
|
670
|
-
hint = ( localizeWithPath(
|
|
671
|
-
'vs/workbench/contrib/accessibility/browser/accessibleView',
|
|
672
|
-
'accessibleViewNextPreviousHint',
|
|
673
|
-
"Show the next ({0}) or previous ({1}) item.",
|
|
674
|
-
nextKeybinding,
|
|
675
|
-
previousKeybinding
|
|
676
|
-
));
|
|
677
|
-
}
|
|
678
|
-
else {
|
|
679
|
-
hint = ( localizeWithPath(
|
|
680
|
-
'vs/workbench/contrib/accessibility/browser/accessibleView',
|
|
681
|
-
'chatAccessibleViewNextPreviousHintNoKb',
|
|
682
|
-
"Show the next or previous item by configuring keybindings for the Show Next & Previous in Accessible View commands."
|
|
683
|
-
));
|
|
684
|
-
}
|
|
685
|
-
return hint;
|
|
686
|
-
}
|
|
687
|
-
_getDisableVerbosityHint(verbositySettingKey) {
|
|
688
|
-
if (!this._configurationService.getValue(verbositySettingKey)) {
|
|
689
|
-
return '';
|
|
690
|
-
}
|
|
691
|
-
let hint = '';
|
|
692
|
-
const disableKeybinding = this._keybindingService.lookupKeybinding("editor.action.accessibleViewDisableHint" , this._contextKeyService)?.getAriaLabel();
|
|
693
|
-
if (disableKeybinding) {
|
|
694
|
-
hint = ( localizeWithPath(
|
|
695
|
-
'vs/workbench/contrib/accessibility/browser/accessibleView',
|
|
696
|
-
'acessibleViewDisableHint',
|
|
697
|
-
"\n\nDisable accessibility verbosity for this feature ({0}).",
|
|
698
|
-
disableKeybinding
|
|
699
|
-
));
|
|
700
|
-
}
|
|
701
|
-
else {
|
|
702
|
-
hint = ( localizeWithPath(
|
|
703
|
-
'vs/workbench/contrib/accessibility/browser/accessibleView',
|
|
704
|
-
'accessibleViewDisableHintNoKb',
|
|
705
|
-
"\n\nAdd a keybinding for the command Disable Accessible View Hint, which disables accessibility verbosity for this feature.s"
|
|
706
|
-
));
|
|
707
|
-
}
|
|
708
|
-
return hint;
|
|
709
|
-
}
|
|
710
|
-
_getGoToSymbolHint(providerHasSymbols) {
|
|
711
|
-
const goToSymbolKb = this._keybindingService.lookupKeybinding("editor.action.accessibleViewGoToSymbol" )?.getAriaLabel();
|
|
712
|
-
let goToSymbolHint = '';
|
|
713
|
-
if (providerHasSymbols) {
|
|
714
|
-
if (goToSymbolKb) {
|
|
715
|
-
goToSymbolHint = ( localizeWithPath(
|
|
716
|
-
'vs/workbench/contrib/accessibility/browser/accessibleView',
|
|
717
|
-
'goToSymbolHint',
|
|
718
|
-
'Go to a symbol ({0}).',
|
|
719
|
-
goToSymbolKb
|
|
720
|
-
));
|
|
721
|
-
}
|
|
722
|
-
else {
|
|
723
|
-
goToSymbolHint = ( localizeWithPath(
|
|
724
|
-
'vs/workbench/contrib/accessibility/browser/accessibleView',
|
|
725
|
-
'goToSymbolHintNoKb',
|
|
726
|
-
'To go to a symbol, configure a keybinding for the command Go To Symbol in Accessible View'
|
|
727
|
-
));
|
|
728
|
-
}
|
|
729
|
-
}
|
|
730
|
-
return goToSymbolHint;
|
|
731
|
-
}
|
|
732
|
-
};
|
|
733
|
-
AccessibleView = ( __decorate([
|
|
734
|
-
( __param(0, IOpenerService)),
|
|
735
|
-
( __param(1, IInstantiationService)),
|
|
736
|
-
( __param(2, IConfigurationService)),
|
|
737
|
-
( __param(3, IModelService)),
|
|
738
|
-
( __param(4, IContextViewService)),
|
|
739
|
-
( __param(5, IContextKeyService)),
|
|
740
|
-
( __param(6, IAccessibilityService)),
|
|
741
|
-
( __param(7, IKeybindingService)),
|
|
742
|
-
( __param(8, ILayoutService)),
|
|
743
|
-
( __param(9, IMenuService)),
|
|
744
|
-
( __param(10, ICommandService)),
|
|
745
|
-
( __param(11, IChatCodeBlockContextProviderService))
|
|
746
|
-
], AccessibleView));
|
|
747
|
-
let AccessibleViewService = class AccessibleViewService extends Disposable {
|
|
748
|
-
constructor(_instantiationService, _configurationService, _keybindingService) {
|
|
749
|
-
super();
|
|
750
|
-
this._instantiationService = _instantiationService;
|
|
751
|
-
this._configurationService = _configurationService;
|
|
752
|
-
this._keybindingService = _keybindingService;
|
|
753
|
-
}
|
|
754
|
-
show(provider, position) {
|
|
755
|
-
if (!this._accessibleView) {
|
|
756
|
-
this._accessibleView = this._register(this._instantiationService.createInstance(AccessibleView));
|
|
757
|
-
}
|
|
758
|
-
this._accessibleView.show(provider, undefined, undefined, position);
|
|
759
|
-
}
|
|
760
|
-
showLastProvider(id) {
|
|
761
|
-
this._accessibleView?.showLastProvider(id);
|
|
762
|
-
}
|
|
763
|
-
next() {
|
|
764
|
-
this._accessibleView?.next();
|
|
765
|
-
}
|
|
766
|
-
previous() {
|
|
767
|
-
this._accessibleView?.previous();
|
|
768
|
-
}
|
|
769
|
-
goToSymbol() {
|
|
770
|
-
this._accessibleView?.goToSymbol();
|
|
771
|
-
}
|
|
772
|
-
getOpenAriaHint(verbositySettingKey) {
|
|
773
|
-
if (!this._configurationService.getValue(verbositySettingKey)) {
|
|
774
|
-
return null;
|
|
775
|
-
}
|
|
776
|
-
const keybinding = this._keybindingService.lookupKeybinding("editor.action.accessibleView" )?.getAriaLabel();
|
|
777
|
-
let hint = null;
|
|
778
|
-
if (keybinding) {
|
|
779
|
-
hint = ( localizeWithPath(
|
|
780
|
-
'vs/workbench/contrib/accessibility/browser/accessibleView',
|
|
781
|
-
'acessibleViewHint',
|
|
782
|
-
"Inspect this in the accessible view with {0}",
|
|
783
|
-
keybinding
|
|
784
|
-
));
|
|
785
|
-
}
|
|
786
|
-
else {
|
|
787
|
-
hint = ( localizeWithPath(
|
|
788
|
-
'vs/workbench/contrib/accessibility/browser/accessibleView',
|
|
789
|
-
'acessibleViewHintNoKbEither',
|
|
790
|
-
"Inspect this in the accessible view via the command Open Accessible View which is currently not triggerable via keybinding."
|
|
791
|
-
));
|
|
792
|
-
}
|
|
793
|
-
return hint;
|
|
794
|
-
}
|
|
795
|
-
disableHint() {
|
|
796
|
-
this._accessibleView?.disableHint();
|
|
797
|
-
}
|
|
798
|
-
showAccessibleViewHelp() {
|
|
799
|
-
this._accessibleView?.showAccessibleViewHelp();
|
|
800
|
-
}
|
|
801
|
-
getPosition(id) {
|
|
802
|
-
return this._accessibleView?.getPosition(id) ?? undefined;
|
|
803
|
-
}
|
|
804
|
-
getLastPosition() {
|
|
805
|
-
const lastLine = this._accessibleView?.editorWidget.getModel()?.getLineCount();
|
|
806
|
-
return lastLine !== undefined && lastLine > 0 ? ( new Position(lastLine, 1)) : undefined;
|
|
807
|
-
}
|
|
808
|
-
setPosition(position, reveal) {
|
|
809
|
-
const editorWidget = this._accessibleView?.editorWidget;
|
|
810
|
-
editorWidget?.setPosition(position);
|
|
811
|
-
if (reveal) {
|
|
812
|
-
editorWidget?.revealLine(position.lineNumber);
|
|
813
|
-
}
|
|
814
|
-
}
|
|
815
|
-
getCodeBlockContext() {
|
|
816
|
-
return this._accessibleView?.getCodeBlockContext();
|
|
817
|
-
}
|
|
818
|
-
};
|
|
819
|
-
AccessibleViewService = ( __decorate([
|
|
820
|
-
( __param(0, IInstantiationService)),
|
|
821
|
-
( __param(1, IConfigurationService)),
|
|
822
|
-
( __param(2, IKeybindingService))
|
|
823
|
-
], AccessibleViewService));
|
|
824
|
-
let AccessibleViewSymbolQuickPick = class AccessibleViewSymbolQuickPick {
|
|
825
|
-
constructor(_accessibleView, _quickInputService) {
|
|
826
|
-
this._accessibleView = _accessibleView;
|
|
827
|
-
this._quickInputService = _quickInputService;
|
|
828
|
-
}
|
|
829
|
-
show(provider) {
|
|
830
|
-
const quickPick = this._quickInputService.createQuickPick();
|
|
831
|
-
quickPick.placeholder = ( localizeWithPath(
|
|
832
|
-
'vs/workbench/contrib/accessibility/browser/accessibleView',
|
|
833
|
-
'accessibleViewSymbolQuickPickPlaceholder',
|
|
834
|
-
"Type to search symbols"
|
|
835
|
-
));
|
|
836
|
-
quickPick.title = ( localizeWithPath(
|
|
837
|
-
'vs/workbench/contrib/accessibility/browser/accessibleView',
|
|
838
|
-
'accessibleViewSymbolQuickPickTitle',
|
|
839
|
-
"Go to Symbol Accessible View"
|
|
840
|
-
));
|
|
841
|
-
const symbols = this._accessibleView.getSymbols();
|
|
842
|
-
if (!symbols) {
|
|
843
|
-
return;
|
|
844
|
-
}
|
|
845
|
-
for (const symbol of symbols) {
|
|
846
|
-
}
|
|
847
|
-
quickPick.canSelectMany = false;
|
|
848
|
-
quickPick.items = symbols;
|
|
849
|
-
quickPick.show();
|
|
850
|
-
quickPick.onDidAccept(() => {
|
|
851
|
-
this._accessibleView.showSymbol(provider, quickPick.selectedItems[0]);
|
|
852
|
-
quickPick.hide();
|
|
853
|
-
});
|
|
854
|
-
quickPick.onDidHide(() => {
|
|
855
|
-
if (quickPick.selectedItems.length === 0) {
|
|
856
|
-
this._accessibleView.show(provider);
|
|
857
|
-
}
|
|
858
|
-
});
|
|
859
|
-
}
|
|
860
|
-
};
|
|
861
|
-
AccessibleViewSymbolQuickPick = ( __decorate([
|
|
862
|
-
( __param(1, IQuickInputService))
|
|
863
|
-
], AccessibleViewSymbolQuickPick));
|
|
864
|
-
function shouldHide(event, keybindingService, configurationService) {
|
|
865
|
-
if (!configurationService.getValue("accessibility.accessibleView.closeOnKeyPress" )) {
|
|
866
|
-
return false;
|
|
867
|
-
}
|
|
868
|
-
const standardKeyboardEvent = ( new StandardKeyboardEvent(event));
|
|
869
|
-
const resolveResult = keybindingService.softDispatch(standardKeyboardEvent, standardKeyboardEvent.target);
|
|
870
|
-
const isValidChord = resolveResult.kind === 1 ;
|
|
871
|
-
if (keybindingService.inChordMode || isValidChord) {
|
|
872
|
-
return false;
|
|
873
|
-
}
|
|
874
|
-
return shouldHandleKey(event) && !event.ctrlKey && !event.altKey && !event.metaKey && !event.shiftKey;
|
|
875
|
-
}
|
|
876
|
-
function shouldHandleKey(event) {
|
|
877
|
-
return !!event.code.match(/^(Key[A-Z]|Digit[0-9]|Equal|Comma|Period|Slash|Quote|Backquote|Backslash|Minus|Semicolon|Space|Enter)$/);
|
|
878
|
-
}
|
|
879
|
-
|
|
880
|
-
export { AccessibleView, AccessibleViewService };
|