Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/src/vs/workbench/contrib/debug/browser/replAccessibilityHelp.ts
3296 views
1
/*---------------------------------------------------------------------------------------------
2
* Copyright (c) Microsoft Corporation. All rights reserved.
3
* Licensed under the MIT License. See License.txt in the project root for license information.
4
*--------------------------------------------------------------------------------------------*/
5
6
import { ServicesAccessor } from '../../../../editor/browser/editorExtensions.js';
7
import { AccessibleViewProviderId, AccessibleViewType, IAccessibleViewContentProvider } from '../../../../platform/accessibility/browser/accessibleView.js';
8
import { IAccessibleViewImplementation } from '../../../../platform/accessibility/browser/accessibleViewRegistry.js';
9
import { ContextKeyExpr } from '../../../../platform/contextkey/common/contextkey.js';
10
import { Disposable } from '../../../../base/common/lifecycle.js';
11
import { getReplView, Repl } from './repl.js';
12
import { IViewsService } from '../../../services/views/common/viewsService.js';
13
import { AccessibilityVerbositySettingId } from '../../accessibility/browser/accessibilityConfiguration.js';
14
import { localize } from '../../../../nls.js';
15
16
export class ReplAccessibilityHelp implements IAccessibleViewImplementation {
17
priority = 120;
18
name = 'replHelp';
19
when = ContextKeyExpr.equals('focusedView', 'workbench.panel.repl.view');
20
type: AccessibleViewType = AccessibleViewType.Help;
21
getProvider(accessor: ServicesAccessor) {
22
const viewsService = accessor.get(IViewsService);
23
const replView = getReplView(viewsService);
24
if (!replView) {
25
return undefined;
26
}
27
return new ReplAccessibilityHelpProvider(replView);
28
}
29
}
30
31
class ReplAccessibilityHelpProvider extends Disposable implements IAccessibleViewContentProvider {
32
public readonly id = AccessibleViewProviderId.ReplHelp;
33
public readonly verbositySettingKey = AccessibilityVerbositySettingId.Debug;
34
public readonly options = { type: AccessibleViewType.Help };
35
private _treeHadFocus = false;
36
constructor(private readonly _replView: Repl) {
37
super();
38
this._treeHadFocus = !!_replView.getFocusedElement();
39
}
40
41
public onClose(): void {
42
if (this._treeHadFocus) {
43
return this._replView.focusTree();
44
}
45
this._replView.getReplInput().focus();
46
}
47
48
public provideContent(): string {
49
return [
50
localize('repl.help', "The debug console is a Read-Eval-Print-Loop that allows you to evaluate expressions and run commands and can be focused with{0}.", '<keybinding:workbench.panel.repl.view.focus>'),
51
localize('repl.output', "The debug console output can be navigated to from the input field with the Focus Previous Widget command{0}.", '<keybinding:widgetNavigation.focusPrevious>'),
52
localize('repl.input', "The debug console input can be navigated to from the output with the Focus Next Widget command{0}.", '<keybinding:widgetNavigation.focusNext>'),
53
localize('repl.history', "The debug console output history can be navigated with the up and down arrow keys."),
54
localize('repl.accessibleView', "The Open Accessible View command{0} will allow character by character navigation of the console output.", '<keybinding:editor.action.accessibleView>'),
55
localize('repl.showRunAndDebug', "The Show Run and Debug view command{0} will open the Run and Debug view and provides more information about debugging.", '<keybinding:workbench.view.debug>'),
56
localize('repl.clear', "The Debug: Clear Console command{0} will clear the console output.", '<keybinding:workbench.debug.panel.action.clearReplAction>'),
57
localize('repl.lazyVariables', "The setting `debug.expandLazyVariables` controls whether variables are evaluated automatically. This is enabled by default when using a screen reader."),
58
].join('\n');
59
}
60
}
61
62
63