Path: blob/main/src/vs/workbench/contrib/codeEditor/browser/inspectKeybindings.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*--------------------------------------------------------------------------------------------*/45import { localize2 } from '../../../../nls.js';6import { ICodeEditor } from '../../../../editor/browser/editorBrowser.js';7import { ServicesAccessor } from '../../../../editor/browser/editorExtensions.js';8import { IKeybindingService } from '../../../../platform/keybinding/common/keybinding.js';9import { IEditorService } from '../../../services/editor/common/editorService.js';10import { Categories } from '../../../../platform/action/common/actionCommonCategories.js';11import { Action2, registerAction2 } from '../../../../platform/actions/common/actions.js';1213class InspectKeyMap extends Action2 {1415constructor() {16super({17id: 'workbench.action.inspectKeyMappings',18title: localize2('workbench.action.inspectKeyMap', 'Inspect Key Mappings'),19category: Categories.Developer,20f1: true21});22}2324run(accessor: ServicesAccessor, editor: ICodeEditor): void {25const keybindingService = accessor.get(IKeybindingService);26const editorService = accessor.get(IEditorService);2728editorService.openEditor({ resource: undefined, contents: keybindingService._dumpDebugInfo(), options: { pinned: true } });29}30}3132registerAction2(InspectKeyMap);3334class InspectKeyMapJSON extends Action2 {3536constructor() {37super({38id: 'workbench.action.inspectKeyMappingsJSON',39title: localize2('workbench.action.inspectKeyMapJSON', 'Inspect Key Mappings (JSON)'),40category: Categories.Developer,41f1: true42});43}4445override async run(accessor: ServicesAccessor): Promise<void> {46const editorService = accessor.get(IEditorService);47const keybindingService = accessor.get(IKeybindingService);4849await editorService.openEditor({ resource: undefined, contents: keybindingService._dumpDebugInfoJSON(), options: { pinned: true } });50}51}5253registerAction2(InspectKeyMapJSON);545556