Path: blob/main/src/vs/workbench/contrib/debug/browser/replAccessibilityHelp.ts
5222 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';14import { CONTEXT_IN_DEBUG_REPL } from '../common/debug.js';1516export class ReplAccessibilityHelp implements IAccessibleViewImplementation {17priority = 120;18name = 'replHelp';19when = ContextKeyExpr.or(20ContextKeyExpr.equals('focusedView', 'workbench.panel.repl.view'),21CONTEXT_IN_DEBUG_REPL22);23type: AccessibleViewType = AccessibleViewType.Help;24getProvider(accessor: ServicesAccessor) {25const viewsService = accessor.get(IViewsService);26const replView = getReplView(viewsService);27if (!replView) {28return undefined;29}30return new ReplAccessibilityHelpProvider(replView);31}32}3334class ReplAccessibilityHelpProvider extends Disposable implements IAccessibleViewContentProvider {35public readonly id = AccessibleViewProviderId.ReplHelp;36public readonly verbositySettingKey = AccessibilityVerbositySettingId.Find;37public readonly options = { type: AccessibleViewType.Help };38constructor(private readonly _replView: Repl) {39super();40}4142public onClose(): void {43this._replView.focusFilter();44}4546public provideContent(): string {47const content: string[] = [];4849// Header50content.push(localize('repl.header', "Accessibility Help: Debug Console Filter"));51content.push(localize('repl.context', "You are in the Debug Console filter input. This is a filter that instantly hides console messages that do not match your filter, showing only the messages you want to see."));52content.push('');5354// Current Filter Status55content.push(localize('repl.statusHeader', "Current Filter Status:"));56content.push(localize('repl.statusDesc', "You are filtering the console output."));57content.push('');5859// Inside the Filter Input60content.push(localize('repl.inputHeader', "Inside the Filter Input (What It Does):"));61content.push(localize('repl.inputDesc', "While you are in the filter input, your focus stays in the field. You can type, edit, or adjust your filter without leaving the input. As you type, the console instantly updates to show only messages matching your filter."));62content.push('');6364// What Happens When You Filter65content.push(localize('repl.filterHeader', "What Happens When You Filter:"));66content.push(localize('repl.filterDesc', "Each time you change the filter text, the console instantly regenerates to show only matching messages. Your screen reader announces how many messages are now visible. This is live feedback: text searches console output, variable values, and log messages."));67content.push('');6869// Focus Behavior70content.push(localize('repl.focusHeader', "Focus Behavior (Important):"));71content.push(localize('repl.focusDesc1', "Your focus stays in the filter input while the console updates in the background. This is intentional, so you can keep typing without losing your place."));72content.push(localize('repl.focusDesc2', "If you want to review the filtered console output, press Down Arrow to move focus from the filter into the console messages above."));73content.push(localize('repl.focusDesc3', "Important: The console input area is at the bottom of the console, separate from the filter. To evaluate expressions, navigate to the console input (after the filtered messages) and type your expression."));74content.push('');7576// Distinguishing Filter from Console Input77content.push(localize('repl.distinguishHeader', "Distinguishing Filter from Console Input:"));78content.push(localize('repl.distinguishFilter', "The filter input is where you are now. It hides or shows messages without running code."));79content.push(localize('repl.distinguishConsole', "The console input is at the bottom of the console, after all displayed messages. That is where you type and press Enter to evaluate expressions during debugging."));80content.push(localize('repl.distinguishSwitch', "To switch to the console input and evaluate an expression, use {0} to focus the console input.", '<keybinding:workbench.panel.repl.view.focus>'));81content.push('');8283// Filter Syntax84content.push(localize('repl.syntaxHeader', "Filter Syntax and Patterns:"));85content.push(localize('repl.syntaxText', "- Type text: Shows only messages containing that text."));86content.push(localize('repl.syntaxExclude', "- !text (exclude): Hides messages containing the text, showing all others."));87content.push('');8889// Keyboard Navigation Summary90content.push(localize('repl.keyboardHeader', "Keyboard Navigation Summary:"));91content.push(localize('repl.keyDown', "- Down Arrow: Move focus from filter into the console output."));92content.push(localize('repl.keyTab', "- Tab: Move to other console controls if available."));93content.push(localize('repl.keyEscape', "- Escape: Clear the filter or close the filter."));94content.push(localize('repl.keyFocus', "- {0}: Focus the console input to evaluate expressions.", '<keybinding:workbench.panel.repl.view.focus>'));95content.push('');9697// Settings98content.push(localize('repl.settingsHeader', "Settings You Can Adjust ({0} opens Settings):", '<keybinding:workbench.action.openSettings>'));99content.push(localize('repl.settingsIntro', "These settings affect the Debug Console."));100content.push(localize('repl.settingVerbosity', "- `accessibility.verbosity.find`: Controls whether the filter input announces the Accessibility Help hint."));101content.push(localize('repl.settingCloseOnEnd', "- `debug.console.closeOnEnd`: Automatically close the Debug Console when the debugging session ends."));102content.push(localize('repl.settingFontSize', "- `debug.console.fontSize`: Font size in the console."));103content.push(localize('repl.settingFontFamily', "- `debug.console.fontFamily`: Font family in the console."));104content.push(localize('repl.settingWordWrap', "- `debug.console.wordWrap`: Wrap lines in the console."));105content.push(localize('repl.settingHistory', "- `debug.console.historySuggestions`: Suggest previously typed input."));106content.push(localize('repl.settingCollapse', "- `debug.console.collapseIdenticalLines`: Collapse repeated messages with a count."));107content.push(localize('repl.settingMaxLines', "- `debug.console.maximumLines`: Maximum number of messages to keep in the console."));108content.push('');109110// Closing111content.push(localize('repl.closingHeader', "Closing:"));112content.push(localize('repl.closingDesc', "Press Escape to clear the filter, or close the Debug Console. Your filter text is preserved if you reopen the console."));113114return content.join('\n');115}116}117118119120