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