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
5222 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
import { CONTEXT_IN_DEBUG_REPL } from '../common/debug.js';
16
17
export class ReplAccessibilityHelp implements IAccessibleViewImplementation {
18
priority = 120;
19
name = 'replHelp';
20
when = ContextKeyExpr.or(
21
ContextKeyExpr.equals('focusedView', 'workbench.panel.repl.view'),
22
CONTEXT_IN_DEBUG_REPL
23
);
24
type: AccessibleViewType = AccessibleViewType.Help;
25
getProvider(accessor: ServicesAccessor) {
26
const viewsService = accessor.get(IViewsService);
27
const replView = getReplView(viewsService);
28
if (!replView) {
29
return undefined;
30
}
31
return new ReplAccessibilityHelpProvider(replView);
32
}
33
}
34
35
class ReplAccessibilityHelpProvider extends Disposable implements IAccessibleViewContentProvider {
36
public readonly id = AccessibleViewProviderId.ReplHelp;
37
public readonly verbositySettingKey = AccessibilityVerbositySettingId.Find;
38
public readonly options = { type: AccessibleViewType.Help };
39
constructor(private readonly _replView: Repl) {
40
super();
41
}
42
43
public onClose(): void {
44
this._replView.focusFilter();
45
}
46
47
public provideContent(): string {
48
const content: string[] = [];
49
50
// Header
51
content.push(localize('repl.header', "Accessibility Help: Debug Console Filter"));
52
content.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."));
53
content.push('');
54
55
// Current Filter Status
56
content.push(localize('repl.statusHeader', "Current Filter Status:"));
57
content.push(localize('repl.statusDesc', "You are filtering the console output."));
58
content.push('');
59
60
// Inside the Filter Input
61
content.push(localize('repl.inputHeader', "Inside the Filter Input (What It Does):"));
62
content.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."));
63
content.push('');
64
65
// What Happens When You Filter
66
content.push(localize('repl.filterHeader', "What Happens When You Filter:"));
67
content.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."));
68
content.push('');
69
70
// Focus Behavior
71
content.push(localize('repl.focusHeader', "Focus Behavior (Important):"));
72
content.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."));
73
content.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."));
74
content.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."));
75
content.push('');
76
77
// Distinguishing Filter from Console Input
78
content.push(localize('repl.distinguishHeader', "Distinguishing Filter from Console Input:"));
79
content.push(localize('repl.distinguishFilter', "The filter input is where you are now. It hides or shows messages without running code."));
80
content.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."));
81
content.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>'));
82
content.push('');
83
84
// Filter Syntax
85
content.push(localize('repl.syntaxHeader', "Filter Syntax and Patterns:"));
86
content.push(localize('repl.syntaxText', "- Type text: Shows only messages containing that text."));
87
content.push(localize('repl.syntaxExclude', "- !text (exclude): Hides messages containing the text, showing all others."));
88
content.push('');
89
90
// Keyboard Navigation Summary
91
content.push(localize('repl.keyboardHeader', "Keyboard Navigation Summary:"));
92
content.push(localize('repl.keyDown', "- Down Arrow: Move focus from filter into the console output."));
93
content.push(localize('repl.keyTab', "- Tab: Move to other console controls if available."));
94
content.push(localize('repl.keyEscape', "- Escape: Clear the filter or close the filter."));
95
content.push(localize('repl.keyFocus', "- {0}: Focus the console input to evaluate expressions.", '<keybinding:workbench.panel.repl.view.focus>'));
96
content.push('');
97
98
// Settings
99
content.push(localize('repl.settingsHeader', "Settings You Can Adjust ({0} opens Settings):", '<keybinding:workbench.action.openSettings>'));
100
content.push(localize('repl.settingsIntro', "These settings affect the Debug Console."));
101
content.push(localize('repl.settingVerbosity', "- `accessibility.verbosity.find`: Controls whether the filter input announces the Accessibility Help hint."));
102
content.push(localize('repl.settingCloseOnEnd', "- `debug.console.closeOnEnd`: Automatically close the Debug Console when the debugging session ends."));
103
content.push(localize('repl.settingFontSize', "- `debug.console.fontSize`: Font size in the console."));
104
content.push(localize('repl.settingFontFamily', "- `debug.console.fontFamily`: Font family in the console."));
105
content.push(localize('repl.settingWordWrap', "- `debug.console.wordWrap`: Wrap lines in the console."));
106
content.push(localize('repl.settingHistory', "- `debug.console.historySuggestions`: Suggest previously typed input."));
107
content.push(localize('repl.settingCollapse', "- `debug.console.collapseIdenticalLines`: Collapse repeated messages with a count."));
108
content.push(localize('repl.settingMaxLines', "- `debug.console.maximumLines`: Maximum number of messages to keep in the console."));
109
content.push('');
110
111
// Closing
112
content.push(localize('repl.closingHeader', "Closing:"));
113
content.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."));
114
115
return content.join('\n');
116
}
117
}
118
119
120