1 | "use strict";
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 | var QuickHelpService_1;
|
18 | Object.defineProperty(exports, "__esModule", { value: true });
|
19 | exports.QuickHelpService = void 0;
|
20 | const tslib_1 = require("tslib");
|
21 | const inversify_1 = require("inversify");
|
22 | const quick_access_1 = require("./quick-access");
|
23 | const quick_input_service_1 = require("./quick-input-service");
|
24 | let QuickHelpService = QuickHelpService_1 = class QuickHelpService {
|
25 | getPicks(filter, token) {
|
26 | const { editorProviders, globalProviders } = this.getQuickAccessProviders();
|
27 | const result = editorProviders.length === 0 || globalProviders.length === 0 ?
|
28 |
|
29 | [
|
30 | ...(editorProviders.length === 0 ? globalProviders : editorProviders)
|
31 | ] :
|
32 |
|
33 | [
|
34 | { type: 'separator', label: 'global commands' },
|
35 | ...globalProviders,
|
36 | { type: 'separator', label: 'editor commands' },
|
37 | ...editorProviders
|
38 | ];
|
39 | return result;
|
40 | }
|
41 | getQuickAccessProviders() {
|
42 | const globalProviders = [];
|
43 | const editorProviders = [];
|
44 | const providers = this.quickAccessRegistry.getQuickAccessProviders();
|
45 | for (const provider of providers.sort((providerA, providerB) => providerA.prefix.localeCompare(providerB.prefix))) {
|
46 | if (provider.prefix === QuickHelpService_1.PREFIX) {
|
47 | continue;
|
48 | }
|
49 | for (const helpEntry of provider.helpEntries) {
|
50 | const prefix = helpEntry.prefix || provider.prefix;
|
51 | const label = prefix || '\u2026' ;
|
52 | (helpEntry.needsEditor ? editorProviders : globalProviders).push({
|
53 | label,
|
54 | ariaLabel: `${label}, ${helpEntry.description}`,
|
55 | description: helpEntry.description,
|
56 | execute: () => this.quickInputService.open(prefix)
|
57 | });
|
58 | }
|
59 | }
|
60 | return { editorProviders, globalProviders };
|
61 | }
|
62 | registerQuickAccessProvider() {
|
63 | this.quickAccessRegistry.registerQuickAccessProvider({
|
64 | getInstance: () => this,
|
65 | prefix: QuickHelpService_1.PREFIX,
|
66 | placeholder: 'Type "?" to get help on the actions you can take from here.',
|
67 | helpEntries: [{ description: 'Show all Quick Access Providers', needsEditor: false }]
|
68 | });
|
69 | }
|
70 | };
|
71 | QuickHelpService.PREFIX = '?';
|
72 | (0, tslib_1.__decorate)([
|
73 | (0, inversify_1.inject)(quick_access_1.QuickAccessRegistry),
|
74 | (0, tslib_1.__metadata)("design:type", Object)
|
75 | ], QuickHelpService.prototype, "quickAccessRegistry", void 0);
|
76 | (0, tslib_1.__decorate)([
|
77 | (0, inversify_1.inject)(quick_input_service_1.QuickInputService),
|
78 | (0, tslib_1.__metadata)("design:type", Object)
|
79 | ], QuickHelpService.prototype, "quickInputService", void 0);
|
80 | QuickHelpService = QuickHelpService_1 = (0, tslib_1.__decorate)([
|
81 | (0, inversify_1.injectable)()
|
82 | ], QuickHelpService);
|
83 | exports.QuickHelpService = QuickHelpService;
|
84 |
|
\ | No newline at end of file |