1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.QuickCommandFrontendContribution = void 0;
|
4 | const tslib_1 = require("tslib");
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 | const inversify_1 = require("inversify");
|
21 | const common_1 = require("../../common");
|
22 | const common_frontend_contribution_1 = require("../common-frontend-contribution");
|
23 | const quick_command_service_1 = require("./quick-command-service");
|
24 | const quick_input_service_1 = require("./quick-input-service");
|
25 | const dialogs_1 = require("../dialogs");
|
26 | let QuickCommandFrontendContribution = class QuickCommandFrontendContribution {
|
27 | registerCommands(commands) {
|
28 | commands.registerCommand(quick_command_service_1.quickCommand, {
|
29 | execute: () => {
|
30 | var _a;
|
31 | (_a = this.quickInputService) === null || _a === void 0 ? void 0 : _a.open('>');
|
32 | }
|
33 | });
|
34 | commands.registerCommand(quick_command_service_1.CLEAR_COMMAND_HISTORY, {
|
35 | execute: async () => {
|
36 | const shouldClear = await new dialogs_1.ConfirmDialog({
|
37 | title: common_1.nls.localizeByDefault('Clear Command History'),
|
38 | msg: common_1.nls.localizeByDefault('Do you want to clear the history of recently used commands?'),
|
39 | ok: common_1.nls.localizeByDefault('Clear'),
|
40 | cancel: dialogs_1.Dialog.CANCEL,
|
41 | }).open();
|
42 | if (shouldClear) {
|
43 | commands.clearCommandHistory();
|
44 | }
|
45 | }
|
46 | });
|
47 | commands.registerCommand(quick_command_service_1.CLOSE_QUICK_OPEN, {
|
48 | execute: () => { var _a; return (_a = this.quickInputService) === null || _a === void 0 ? void 0 : _a.hide(); }
|
49 | });
|
50 | }
|
51 | registerMenus(menus) {
|
52 | menus.registerMenuAction(common_frontend_contribution_1.CommonMenus.VIEW_PRIMARY, {
|
53 | commandId: quick_command_service_1.quickCommand.id,
|
54 | label: common_1.nls.localizeByDefault('Command Palette...')
|
55 | });
|
56 | menus.registerMenuAction(common_frontend_contribution_1.CommonMenus.MANAGE_GENERAL, {
|
57 | commandId: quick_command_service_1.quickCommand.id,
|
58 | label: common_1.nls.localizeByDefault('Command Palette...'),
|
59 | order: '0'
|
60 | });
|
61 | }
|
62 | registerKeybindings(keybindings) {
|
63 | keybindings.registerKeybinding({
|
64 | command: quick_command_service_1.quickCommand.id,
|
65 | keybinding: 'f1'
|
66 | });
|
67 | keybindings.registerKeybinding({
|
68 | command: quick_command_service_1.quickCommand.id,
|
69 | keybinding: 'ctrlcmd+shift+p'
|
70 | });
|
71 | keybindings.registerKeybinding({
|
72 | command: quick_command_service_1.CLOSE_QUICK_OPEN.id,
|
73 | keybinding: 'esc',
|
74 | when: 'inQuickOpen'
|
75 | });
|
76 | keybindings.registerKeybinding({
|
77 | command: quick_command_service_1.CLOSE_QUICK_OPEN.id,
|
78 | keybinding: 'shift+esc',
|
79 | when: 'inQuickOpen'
|
80 | });
|
81 | }
|
82 | };
|
83 | (0, tslib_1.__decorate)([
|
84 | (0, inversify_1.inject)(quick_input_service_1.QuickInputService),
|
85 | (0, inversify_1.optional)(),
|
86 | (0, tslib_1.__metadata)("design:type", Object)
|
87 | ], QuickCommandFrontendContribution.prototype, "quickInputService", void 0);
|
88 | (0, tslib_1.__decorate)([
|
89 | (0, inversify_1.inject)(quick_command_service_1.QuickCommandService),
|
90 | (0, inversify_1.optional)(),
|
91 | (0, tslib_1.__metadata)("design:type", quick_command_service_1.QuickCommandService)
|
92 | ], QuickCommandFrontendContribution.prototype, "quickCommandService", void 0);
|
93 | QuickCommandFrontendContribution = (0, tslib_1.__decorate)([
|
94 | (0, inversify_1.injectable)()
|
95 | ], QuickCommandFrontendContribution);
|
96 | exports.QuickCommandFrontendContribution = QuickCommandFrontendContribution;
|
97 |
|
\ | No newline at end of file |