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