Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/src/vs/workbench/contrib/codeEditor/browser/inspectKeybindings.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
import { localize2 } from '../../../../nls.js';
7
import { ICodeEditor } from '../../../../editor/browser/editorBrowser.js';
8
import { ServicesAccessor } from '../../../../editor/browser/editorExtensions.js';
9
import { IKeybindingService } from '../../../../platform/keybinding/common/keybinding.js';
10
import { IEditorService } from '../../../services/editor/common/editorService.js';
11
import { Categories } from '../../../../platform/action/common/actionCommonCategories.js';
12
import { Action2, registerAction2 } from '../../../../platform/actions/common/actions.js';
13
14
class InspectKeyMap extends Action2 {
15
16
constructor() {
17
super({
18
id: 'workbench.action.inspectKeyMappings',
19
title: localize2('workbench.action.inspectKeyMap', 'Inspect Key Mappings'),
20
category: Categories.Developer,
21
f1: true
22
});
23
}
24
25
run(accessor: ServicesAccessor, editor: ICodeEditor): void {
26
const keybindingService = accessor.get(IKeybindingService);
27
const editorService = accessor.get(IEditorService);
28
29
editorService.openEditor({ resource: undefined, contents: keybindingService._dumpDebugInfo(), options: { pinned: true } });
30
}
31
}
32
33
registerAction2(InspectKeyMap);
34
35
class InspectKeyMapJSON extends Action2 {
36
37
constructor() {
38
super({
39
id: 'workbench.action.inspectKeyMappingsJSON',
40
title: localize2('workbench.action.inspectKeyMapJSON', 'Inspect Key Mappings (JSON)'),
41
category: Categories.Developer,
42
f1: true
43
});
44
}
45
46
override async run(accessor: ServicesAccessor): Promise<void> {
47
const editorService = accessor.get(IEditorService);
48
const keybindingService = accessor.get(IKeybindingService);
49
50
await editorService.openEditor({ resource: undefined, contents: keybindingService._dumpDebugInfoJSON(), options: { pinned: true } });
51
}
52
}
53
54
registerAction2(InspectKeyMapJSON);
55
56