Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/src/vs/workbench/contrib/output/browser/outputAccessibilityHelp.ts
5241 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 { Disposable } from '../../../../base/common/lifecycle.js';
7
import { AccessibleViewType, AccessibleContentProvider, IAccessibleViewContentProvider, AccessibleViewProviderId } from '../../../../platform/accessibility/browser/accessibleView.js';
8
import { IAccessibleViewImplementation } from '../../../../platform/accessibility/browser/accessibleViewRegistry.js';
9
import { ServicesAccessor } from '../../../../platform/instantiation/common/instantiation.js';
10
import { IKeybindingService } from '../../../../platform/keybinding/common/keybinding.js';
11
import * as nls from '../../../../nls.js';
12
import { AccessibilityVerbositySettingId } from '../../accessibility/browser/accessibilityConfiguration.js';
13
import { OUTPUT_FILTER_FOCUS_CONTEXT } from '../../../services/output/common/output.js';
14
15
export class OutputAccessibilityHelp implements IAccessibleViewImplementation {
16
readonly type = AccessibleViewType.Help;
17
readonly priority = 105;
18
readonly name = 'outputFilter';
19
readonly when = OUTPUT_FILTER_FOCUS_CONTEXT;
20
21
getProvider(accessor: ServicesAccessor): AccessibleContentProvider {
22
return new OutputAccessibilityHelpProvider(accessor.get(IKeybindingService));
23
}
24
}
25
26
class OutputAccessibilityHelpProvider extends Disposable implements IAccessibleViewContentProvider {
27
readonly id = AccessibleViewProviderId.OutputFindHelp;
28
readonly verbositySettingKey = AccessibilityVerbositySettingId.Find;
29
readonly options = { type: AccessibleViewType.Help };
30
31
constructor(
32
private readonly _keybindingService: IKeybindingService,
33
) {
34
super();
35
}
36
37
provideContent(): string {
38
const lines: string[] = [];
39
40
// Header
41
lines.push(nls.localize('output.header', 'Accessibility Help: Output Panel Filter'));
42
lines.push(nls.localize('output.context', 'You are in the Output panel filter input. This is NOT a navigating search. Instead, it instantly hides lines that do not match your filter, showing only the lines you want to see.'));
43
lines.push('');
44
45
// Current Filter Status
46
lines.push(nls.localize('output.statusHeader', 'Current Filter Status:'));
47
lines.push(nls.localize('output.statusDesc', 'You are filtering the output.'));
48
lines.push('');
49
50
// Inside the Filter Input
51
lines.push(nls.localize('output.inputHeader', 'Inside the Filter Input (What It Does):'));
52
lines.push(nls.localize('output.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 Output panel instantly updates to show only lines matching your filter.'));
53
lines.push('');
54
55
// What Happens When You Filter
56
lines.push(nls.localize('output.filterHeader', 'What Happens When You Filter:'));
57
lines.push(nls.localize('output.filterDesc1', 'Each time you change the filter text, the panel instantly regenerates to show only matching lines. Your screen reader announces how many lines are now visible. This is live feedback: as you type or delete characters, the displayed lines update immediately.'));
58
lines.push(nls.localize('output.filterDesc2', 'New output from your running program is appended to the panel and automatically filtered, so matching new output appears instantly.'));
59
lines.push('');
60
61
// Focus Behavior
62
lines.push(nls.localize('output.focusHeader', 'Focus Behavior (Important):'));
63
lines.push(nls.localize('output.focusDesc1', 'Your focus stays in the filter input while the panel updates in the background. This is intentional, so you can keep typing without losing your place.'));
64
lines.push(nls.localize('output.focusDesc2', 'If you want to review the filtered output, press Down Arrow to move focus from the filter into the output content below.'));
65
lines.push(nls.localize('output.focusDesc3', 'If you want to clear the filter and see all output, press Escape or delete all filter text.'));
66
lines.push('');
67
68
// Filter Syntax
69
lines.push(nls.localize('output.syntaxHeader', 'Filter Syntax and Patterns:'));
70
lines.push(nls.localize('output.syntaxText', '- Type text: Shows only lines containing that text (case-insensitive by default).'));
71
lines.push(nls.localize('output.syntaxExclude', '- !text (exclude): Hides lines containing \'text\', showing all other lines.'));
72
lines.push(nls.localize('output.syntaxEscape', '- \\\\! (escape): Use backslash to search for a literal "!" character.'));
73
lines.push(nls.localize('output.syntaxMultiple', '- text1, text2 (multiple patterns): Separate patterns with commas to show lines matching ANY pattern.'));
74
lines.push(nls.localize('output.syntaxExample', 'Example: typing "error, warning" shows lines containing either "error" or "warning".'));
75
lines.push('');
76
77
// Keyboard Navigation Summary
78
lines.push(nls.localize('output.keyboardHeader', 'Keyboard Navigation Summary:'));
79
lines.push(nls.localize('output.keyDown', '- Down Arrow: Move focus from filter into the output content.'));
80
lines.push(nls.localize('output.keyTab', '- Tab: Move to log level filter buttons if available.'));
81
lines.push(nls.localize('output.keyEscape', '- Escape: Clear the filter and return to showing all output.'));
82
lines.push('');
83
84
// Settings
85
lines.push(nls.localize('output.settingsHeader', 'Settings You Can Adjust ({0} opens Settings):', this._describeCommand('workbench.action.openSettings') || 'Ctrl+,'));
86
lines.push(nls.localize('output.settingsIntro', 'These settings affect how the Output panel works.'));
87
lines.push(nls.localize('output.settingVerbosity', '- `accessibility.verbosity.find`: Controls whether the filter input announces the Accessibility Help hint.'));
88
lines.push(nls.localize('output.settingSmartScroll', '- `output.smartScroll.enabled`: Automatically scroll to the latest output when messages arrive.'));
89
lines.push('');
90
91
// Closing
92
lines.push(nls.localize('output.closingHeader', 'Closing:'));
93
lines.push(nls.localize('output.closingDesc', 'Press Escape to clear the filter and see all output, or close the Output panel. Your filter text is preserved if you reopen the panel.'));
94
95
return lines.join('\n');
96
}
97
98
private _describeCommand(commandId: string): string | undefined {
99
const kb = this._keybindingService.lookupKeybinding(commandId);
100
return kb?.getAriaLabel() ?? undefined;
101
}
102
103
onClose(): void {
104
// No-op
105
}
106
}
107
108