Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/src/vs/workbench/contrib/debug/browser/runAndDebugAccessibilityHelp.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
7
import { ServicesAccessor } from '../../../../editor/browser/editorExtensions.js';
8
import { AccessibleViewProviderId, AccessibleViewType, IAccessibleViewContentProvider } from '../../../../platform/accessibility/browser/accessibleView.js';
9
import { IAccessibleViewImplementation } from '../../../../platform/accessibility/browser/accessibleViewRegistry.js';
10
import { ContextKeyExpr } from '../../../../platform/contextkey/common/contextkey.js';
11
import { Disposable } from '../../../../base/common/lifecycle.js';
12
import { AccessibilityVerbositySettingId } from '../../accessibility/browser/accessibilityConfiguration.js';
13
import { localize } from '../../../../nls.js';
14
import { ICommandService } from '../../../../platform/commands/common/commands.js';
15
import { IViewsService } from '../../../services/views/common/viewsService.js';
16
import { AccessibilityHelpNLS } from '../../../../editor/common/standaloneStrings.js';
17
import { FocusedViewContext, SidebarFocusContext } from '../../../common/contextkeys.js';
18
import { BREAKPOINTS_VIEW_ID, CALLSTACK_VIEW_ID, LOADED_SCRIPTS_VIEW_ID, VARIABLES_VIEW_ID, WATCH_VIEW_ID } from '../common/debug.js';
19
20
export class RunAndDebugAccessibilityHelp implements IAccessibleViewImplementation {
21
priority = 120;
22
name = 'runAndDebugHelp';
23
when = ContextKeyExpr.or(
24
ContextKeyExpr.and(ContextKeyExpr.equals('activeViewlet', 'workbench.view.debug'), SidebarFocusContext),
25
ContextKeyExpr.equals(FocusedViewContext.key, VARIABLES_VIEW_ID),
26
ContextKeyExpr.equals(FocusedViewContext.key, WATCH_VIEW_ID),
27
ContextKeyExpr.equals(FocusedViewContext.key, CALLSTACK_VIEW_ID),
28
ContextKeyExpr.equals(FocusedViewContext.key, LOADED_SCRIPTS_VIEW_ID),
29
ContextKeyExpr.equals(FocusedViewContext.key, BREAKPOINTS_VIEW_ID)
30
);
31
type: AccessibleViewType = AccessibleViewType.Help;
32
getProvider(accessor: ServicesAccessor) {
33
return new RunAndDebugAccessibilityHelpProvider(accessor.get(ICommandService), accessor.get(IViewsService));
34
}
35
}
36
37
class RunAndDebugAccessibilityHelpProvider extends Disposable implements IAccessibleViewContentProvider {
38
public readonly id = AccessibleViewProviderId.RunAndDebug;
39
public readonly verbositySettingKey = AccessibilityVerbositySettingId.Debug;
40
public readonly options = { type: AccessibleViewType.Help };
41
private _focusedView: string | undefined;
42
constructor(
43
@ICommandService private readonly _commandService: ICommandService,
44
@IViewsService private readonly _viewsService: IViewsService
45
) {
46
super();
47
this._focusedView = this._viewsService.getFocusedViewName();
48
}
49
50
public onClose(): void {
51
switch (this._focusedView) {
52
case 'Watch':
53
this._commandService.executeCommand('workbench.debug.action.focusWatchView');
54
break;
55
case 'Variables':
56
this._commandService.executeCommand('workbench.debug.action.focusVariablesView');
57
break;
58
case 'Call Stack':
59
this._commandService.executeCommand('workbench.debug.action.focusCallStackView');
60
break;
61
case 'Breakpoints':
62
this._commandService.executeCommand('workbench.debug.action.focusBreakpointsView');
63
break;
64
default:
65
this._commandService.executeCommand('workbench.view.debug');
66
}
67
}
68
69
public provideContent(): string {
70
return [
71
localize('debug.showRunAndDebug', "The Show Run and Debug view command{0} will open the current view.", '<keybinding:workbench.view.debug>'),
72
localize('debug.startDebugging', "The Debug: Start Debugging command{0} will start a debug session.", '<keybinding:workbench.action.debug.start>'),
73
localize('debug.help', "Access debug output and evaluate expressions in the debug console, which can be focused with{0}.", '<keybinding:workbench.panel.repl.view.focus>'),
74
AccessibilityHelpNLS.setBreakpoint,
75
AccessibilityHelpNLS.addToWatch,
76
localize('onceDebugging', "Once debugging, the following commands will be available:"),
77
localize('debug.restartDebugging', "- Debug: Restart Debugging command{0} will restart the current debug session.", '<keybinding:workbench.action.debug.restart>'),
78
localize('debug.stopDebugging', "- Debug: Stop Debugging command{0} will stop the current debugging session.", '<keybinding:workbench.action.debug.stop>'),
79
localize('debug.continue', "- Debug: Continue command{0} will continue execution until the next breakpoint.", '<keybinding:workbench.action.debug.continue>'),
80
localize('debug.stepInto', "- Debug: Step Into command{0} will step into the next function call.", '<keybinding:workbench.action.debug.stepInto>'),
81
localize('debug.stepOver', "- Debug: Step Over command{0} will step over the current function call.", '<keybinding:workbench.action.debug.stepOver>'),
82
localize('debug.stepOut', "- Debug: Step Out command{0} will step out of the current function call.", '<keybinding:workbench.action.debug.stepOut>'),
83
localize('debug.views', 'The debug viewlet is comprised of several views that can be focused with the following commands or navigated to via tab then arrow keys:'),
84
localize('debug.focusBreakpoints', "- Debug: Focus Breakpoints View command{0} will focus the breakpoints view.", '<keybinding:workbench.debug.action.focusBreakpointsView>'),
85
localize('debug.focusCallStack', "- Debug: Focus Call Stack View command{0} will focus the call stack view.", '<keybinding:workbench.debug.action.focusCallStackView>'),
86
localize('debug.focusVariables', "- Debug: Focus Variables View command{0} will focus the variables view.", '<keybinding:workbench.debug.action.focusVariablesView>'),
87
localize('debug.focusWatch', "- Debug: Focus Watch View command{0} will focus the watch view.", '<keybinding:workbench.debug.action.focusWatchView>'),
88
localize('debug.watchSetting', "The setting {0} controls whether watch variable changes are announced.", 'accessibility.debugWatchVariableAnnouncements'),
89
].join('\n');
90
}
91
}
92
93
94