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