@codingame/monaco-vscode-quickaccess-service-override 4.1.0 → 4.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,228 @@
1
+ import { localize2WithPath, localizeWithPath } from 'vscode/vscode/vs/nls';
2
+ import { registerAction2, Action2, MenuId } from 'vscode/vscode/vs/platform/actions/common/actions';
3
+ import { KeybindingsRegistry } from 'vscode/vscode/vs/platform/keybinding/common/keybindingsRegistry';
4
+ import { IQuickInputService, ItemActivation } from 'vscode/vscode/vs/platform/quickinput/common/quickInput';
5
+ import { IKeybindingService } from 'vscode/vscode/vs/platform/keybinding/common/keybinding';
6
+ import { CommandsRegistry } from 'vscode/vscode/vs/platform/commands/common/commands';
7
+ import { inQuickPickContext, getQuickNavigateHandler, defaultQuickAccessContext } from 'vscode/vscode/vs/workbench/browser/quickaccess';
8
+ import { Codicon } from 'vscode/vscode/vs/base/common/codicons';
9
+
10
+ const globalQuickAccessKeybinding = {
11
+ primary: 2048 | 46 ,
12
+ secondary: [2048 | 35 ],
13
+ mac: { primary: 2048 | 46 , secondary: undefined }
14
+ };
15
+ KeybindingsRegistry.registerCommandAndKeybindingRule({
16
+ id: 'workbench.action.closeQuickOpen',
17
+ weight: 200 ,
18
+ when: inQuickPickContext,
19
+ primary: 9 , secondary: [1024 | 9 ],
20
+ handler: accessor => {
21
+ const quickInputService = accessor.get(IQuickInputService);
22
+ return quickInputService.cancel();
23
+ }
24
+ });
25
+ KeybindingsRegistry.registerCommandAndKeybindingRule({
26
+ id: 'workbench.action.acceptSelectedQuickOpenItem',
27
+ weight: 200 ,
28
+ when: inQuickPickContext,
29
+ primary: 0,
30
+ handler: accessor => {
31
+ const quickInputService = accessor.get(IQuickInputService);
32
+ return quickInputService.accept();
33
+ }
34
+ });
35
+ KeybindingsRegistry.registerCommandAndKeybindingRule({
36
+ id: 'workbench.action.alternativeAcceptSelectedQuickOpenItem',
37
+ weight: 200 ,
38
+ when: inQuickPickContext,
39
+ primary: 0,
40
+ handler: accessor => {
41
+ const quickInputService = accessor.get(IQuickInputService);
42
+ return quickInputService.accept({ ctrlCmd: true, alt: false });
43
+ }
44
+ });
45
+ KeybindingsRegistry.registerCommandAndKeybindingRule({
46
+ id: 'workbench.action.focusQuickOpen',
47
+ weight: 200 ,
48
+ when: inQuickPickContext,
49
+ primary: 0,
50
+ handler: accessor => {
51
+ const quickInputService = accessor.get(IQuickInputService);
52
+ quickInputService.focus();
53
+ }
54
+ });
55
+ const quickAccessNavigateNextInFilePickerId = 'workbench.action.quickOpenNavigateNextInFilePicker';
56
+ KeybindingsRegistry.registerCommandAndKeybindingRule({
57
+ id: quickAccessNavigateNextInFilePickerId,
58
+ weight: 200 + 50,
59
+ handler: getQuickNavigateHandler(quickAccessNavigateNextInFilePickerId, true),
60
+ when: defaultQuickAccessContext,
61
+ primary: globalQuickAccessKeybinding.primary,
62
+ secondary: globalQuickAccessKeybinding.secondary,
63
+ mac: globalQuickAccessKeybinding.mac
64
+ });
65
+ const quickAccessNavigatePreviousInFilePickerId = 'workbench.action.quickOpenNavigatePreviousInFilePicker';
66
+ KeybindingsRegistry.registerCommandAndKeybindingRule({
67
+ id: quickAccessNavigatePreviousInFilePickerId,
68
+ weight: 200 + 50,
69
+ handler: getQuickNavigateHandler(quickAccessNavigatePreviousInFilePickerId, false),
70
+ when: defaultQuickAccessContext,
71
+ primary: globalQuickAccessKeybinding.primary | 1024 ,
72
+ secondary: [globalQuickAccessKeybinding.secondary[0] | 1024 ],
73
+ mac: {
74
+ primary: globalQuickAccessKeybinding.mac.primary | 1024 ,
75
+ secondary: undefined
76
+ }
77
+ });
78
+ KeybindingsRegistry.registerCommandAndKeybindingRule({
79
+ id: 'workbench.action.quickPickManyToggle',
80
+ weight: 200 ,
81
+ when: inQuickPickContext,
82
+ primary: 0,
83
+ handler: accessor => {
84
+ const quickInputService = accessor.get(IQuickInputService);
85
+ quickInputService.toggle();
86
+ }
87
+ });
88
+ KeybindingsRegistry.registerCommandAndKeybindingRule({
89
+ id: 'workbench.action.quickInputBack',
90
+ weight: 200 + 50,
91
+ when: inQuickPickContext,
92
+ primary: 0,
93
+ win: { primary: 512 | 15 },
94
+ mac: { primary: 256 | 88 },
95
+ linux: { primary: 2048 | 512 | 88 },
96
+ handler: accessor => {
97
+ const quickInputService = accessor.get(IQuickInputService);
98
+ quickInputService.back();
99
+ }
100
+ });
101
+ registerAction2(class QuickAccessAction extends Action2 {
102
+ constructor() {
103
+ super({
104
+ id: 'workbench.action.quickOpen',
105
+ title: ( localize2WithPath(
106
+ 'vs/workbench/browser/actions/quickAccessActions',
107
+ 'quickOpen',
108
+ "Go to File..."
109
+ )),
110
+ metadata: {
111
+ description: `Quick access`,
112
+ args: [{
113
+ name: 'prefix',
114
+ schema: {
115
+ 'type': 'string'
116
+ }
117
+ }]
118
+ },
119
+ keybinding: {
120
+ weight: 200 ,
121
+ primary: globalQuickAccessKeybinding.primary,
122
+ secondary: globalQuickAccessKeybinding.secondary,
123
+ mac: globalQuickAccessKeybinding.mac
124
+ },
125
+ f1: true
126
+ });
127
+ }
128
+ run(accessor, prefix) {
129
+ const quickInputService = accessor.get(IQuickInputService);
130
+ quickInputService.quickAccess.show(typeof prefix === 'string' ? prefix : undefined, { preserveValue: typeof prefix === 'string' });
131
+ }
132
+ });
133
+ registerAction2(class QuickAccessAction extends Action2 {
134
+ constructor() {
135
+ super({
136
+ id: 'workbench.action.quickOpenWithModes',
137
+ title: ( localizeWithPath(
138
+ 'vs/workbench/browser/actions/quickAccessActions',
139
+ 'quickOpenWithModes',
140
+ "Quick Open"
141
+ )),
142
+ icon: Codicon.search,
143
+ menu: {
144
+ id: MenuId.CommandCenterCenter,
145
+ order: 100
146
+ }
147
+ });
148
+ }
149
+ run(accessor) {
150
+ const quickInputService = accessor.get(IQuickInputService);
151
+ quickInputService.quickAccess.show(undefined, {
152
+ preserveValue: true,
153
+ providerOptions: {
154
+ includeHelp: true,
155
+ from: 'commandCenter',
156
+ }
157
+ });
158
+ }
159
+ });
160
+ CommandsRegistry.registerCommand('workbench.action.quickOpenPreviousEditor', async (accessor) => {
161
+ const quickInputService = accessor.get(IQuickInputService);
162
+ quickInputService.quickAccess.show('', { itemActivation: ItemActivation.SECOND });
163
+ });
164
+ class BaseQuickAccessNavigateAction extends Action2 {
165
+ constructor(id, title, next, quickNavigate, keybinding) {
166
+ super({ id, title, f1: true, keybinding });
167
+ this.id = id;
168
+ this.next = next;
169
+ this.quickNavigate = quickNavigate;
170
+ }
171
+ async run(accessor) {
172
+ const keybindingService = accessor.get(IKeybindingService);
173
+ const quickInputService = accessor.get(IQuickInputService);
174
+ const keys = keybindingService.lookupKeybindings(this.id);
175
+ const quickNavigate = this.quickNavigate ? { keybindings: keys } : undefined;
176
+ quickInputService.navigate(this.next, quickNavigate);
177
+ }
178
+ }
179
+ class QuickAccessNavigateNextAction extends BaseQuickAccessNavigateAction {
180
+ constructor() {
181
+ super('workbench.action.quickOpenNavigateNext', ( localize2WithPath(
182
+ 'vs/workbench/browser/actions/quickAccessActions',
183
+ 'quickNavigateNext',
184
+ 'Navigate Next in Quick Open'
185
+ )), true, true);
186
+ }
187
+ }
188
+ class QuickAccessNavigatePreviousAction extends BaseQuickAccessNavigateAction {
189
+ constructor() {
190
+ super('workbench.action.quickOpenNavigatePrevious', ( localize2WithPath(
191
+ 'vs/workbench/browser/actions/quickAccessActions',
192
+ 'quickNavigatePrevious',
193
+ 'Navigate Previous in Quick Open'
194
+ )), false, true);
195
+ }
196
+ }
197
+ class QuickAccessSelectNextAction extends BaseQuickAccessNavigateAction {
198
+ constructor() {
199
+ super('workbench.action.quickOpenSelectNext', ( localize2WithPath(
200
+ 'vs/workbench/browser/actions/quickAccessActions',
201
+ 'quickSelectNext',
202
+ 'Select Next in Quick Open'
203
+ )), true, false, {
204
+ weight: 200 + 50,
205
+ when: inQuickPickContext,
206
+ primary: 0,
207
+ mac: { primary: 256 | 44 }
208
+ });
209
+ }
210
+ }
211
+ class QuickAccessSelectPreviousAction extends BaseQuickAccessNavigateAction {
212
+ constructor() {
213
+ super('workbench.action.quickOpenSelectPrevious', ( localize2WithPath(
214
+ 'vs/workbench/browser/actions/quickAccessActions',
215
+ 'quickSelectPrevious',
216
+ 'Select Previous in Quick Open'
217
+ )), false, false, {
218
+ weight: 200 + 50,
219
+ when: inQuickPickContext,
220
+ primary: 0,
221
+ mac: { primary: 256 | 46 }
222
+ });
223
+ }
224
+ }
225
+ registerAction2(QuickAccessSelectNextAction);
226
+ registerAction2(QuickAccessSelectPreviousAction);
227
+ registerAction2(QuickAccessNavigateNextAction);
228
+ registerAction2(QuickAccessNavigatePreviousAction);
@@ -0,0 +1,88 @@
1
+ import { __decorate, __param } from '../../../../../../../../external/tslib/tslib.es6.js';
2
+ import { localize2WithPath, localizeWithPath } from 'vscode/vscode/vs/nls';
3
+ import { IQuickInputService } from 'vscode/vscode/vs/platform/quickinput/common/quickInput';
4
+ import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService';
5
+ import { AbstractGotoLineQuickAccessProvider } from 'vscode/vscode/vs/editor/contrib/quickAccess/browser/gotoLineQuickAccess';
6
+ import { Registry } from 'vscode/vscode/vs/platform/registry/common/platform';
7
+ import { Extensions } from 'vscode/vscode/vs/platform/quickinput/common/quickAccess';
8
+ import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration';
9
+ import { Action2, registerAction2 } from 'vscode/vscode/vs/platform/actions/common/actions';
10
+ import { IEditorGroupsService } from 'vscode/vscode/vs/workbench/services/editor/common/editorGroupsService';
11
+
12
+ let GotoLineQuickAccessProvider = class GotoLineQuickAccessProvider extends AbstractGotoLineQuickAccessProvider {
13
+ constructor(editorService, editorGroupService, configurationService) {
14
+ super();
15
+ this.editorService = editorService;
16
+ this.editorGroupService = editorGroupService;
17
+ this.configurationService = configurationService;
18
+ this.onDidActiveTextEditorControlChange = this.editorService.onDidActiveEditorChange;
19
+ }
20
+ get configuration() {
21
+ const editorConfig = this.configurationService.getValue().workbench?.editor;
22
+ return {
23
+ openEditorPinned: !editorConfig?.enablePreviewFromQuickOpen || !editorConfig?.enablePreview
24
+ };
25
+ }
26
+ get activeTextEditorControl() {
27
+ return this.editorService.activeTextEditorControl;
28
+ }
29
+ gotoLocation(context, options) {
30
+ if ((options.keyMods.alt || (this.configuration.openEditorPinned && options.keyMods.ctrlCmd) || options.forceSideBySide) && this.editorService.activeEditor) {
31
+ context.restoreViewState?.();
32
+ const editorOptions = {
33
+ selection: options.range,
34
+ pinned: options.keyMods.ctrlCmd || this.configuration.openEditorPinned,
35
+ preserveFocus: options.preserveFocus
36
+ };
37
+ this.editorGroupService.sideGroup.openEditor(this.editorService.activeEditor, editorOptions);
38
+ }
39
+ else {
40
+ super.gotoLocation(context, options);
41
+ }
42
+ }
43
+ };
44
+ GotoLineQuickAccessProvider = ( __decorate([
45
+ ( __param(0, IEditorService)),
46
+ ( __param(1, IEditorGroupsService)),
47
+ ( __param(2, IConfigurationService))
48
+ ], GotoLineQuickAccessProvider));
49
+ class GotoLineAction extends Action2 {
50
+ static { this.ID = 'workbench.action.gotoLine'; }
51
+ constructor() {
52
+ super({
53
+ id: GotoLineAction.ID,
54
+ title: ( localize2WithPath(
55
+ 'vs/workbench/contrib/codeEditor/browser/quickaccess/gotoLineQuickAccess',
56
+ 'gotoLine',
57
+ 'Go to Line/Column...'
58
+ )),
59
+ f1: true,
60
+ keybinding: {
61
+ weight: 200 ,
62
+ when: null,
63
+ primary: 2048 | 37 ,
64
+ mac: { primary: 256 | 37 }
65
+ }
66
+ });
67
+ }
68
+ async run(accessor) {
69
+ accessor.get(IQuickInputService).quickAccess.show(GotoLineQuickAccessProvider.PREFIX);
70
+ }
71
+ }
72
+ registerAction2(GotoLineAction);
73
+ ( Registry.as(Extensions.Quickaccess)).registerQuickAccessProvider({
74
+ ctor: GotoLineQuickAccessProvider,
75
+ prefix: AbstractGotoLineQuickAccessProvider.PREFIX,
76
+ placeholder: ( localizeWithPath(
77
+ 'vs/workbench/contrib/codeEditor/browser/quickaccess/gotoLineQuickAccess',
78
+ 'gotoLineQuickAccessPlaceholder',
79
+ "Type the line number and optional column to go to (e.g. 42:5 for line 42 and column 5)."
80
+ )),
81
+ helpEntries: [{ description: ( localizeWithPath(
82
+ 'vs/workbench/contrib/codeEditor/browser/quickaccess/gotoLineQuickAccess',
83
+ 'gotoLineQuickAccess',
84
+ "Go to Line/Column"
85
+ )), commandId: GotoLineAction.ID }]
86
+ });
87
+
88
+ export { GotoLineQuickAccessProvider };
@@ -0,0 +1,295 @@
1
+ import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
2
+ import { isFirefox } from 'vscode/vscode/vs/base/browser/browser';
3
+ import { raceTimeout, timeout } from 'vscode/vscode/vs/base/common/async';
4
+ import { Codicon } from 'vscode/vscode/vs/base/common/codicons';
5
+ import { stripIcons } from 'vscode/vscode/vs/base/common/iconLabels';
6
+ import { Language } from 'vscode/vscode/vs/base/common/platform';
7
+ import { ThemeIcon } from 'vscode/vscode/vs/base/common/themables';
8
+ import { AbstractEditorCommandsQuickAccessProvider } from '../../../../editor/contrib/quickAccess/browser/commandsQuickAccess.js';
9
+ import { localizeWithPath, localize2WithPath } from 'vscode/vscode/vs/nls';
10
+ import { isLocalizedString } from 'vscode/vscode/vs/platform/action/common/action';
11
+ import { MenuId, MenuItemAction, Action2, IMenuService } from 'vscode/vscode/vs/platform/actions/common/actions';
12
+ import { ICommandService } from 'vscode/vscode/vs/platform/commands/common/commands';
13
+ import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration';
14
+ import '../../../../../../../override/vs/platform/dialogs/common/dialogs.js';
15
+ import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
16
+ import { IKeybindingService } from 'vscode/vscode/vs/platform/keybinding/common/keybinding';
17
+ import { IProductService } from 'vscode/vscode/vs/platform/product/common/productService';
18
+ import { CommandsHistory } from '../../../../platform/quickinput/browser/commandsQuickAccess.js';
19
+ import { TriggerAction } from 'vscode/vscode/vs/platform/quickinput/browser/pickerQuickAccess';
20
+ import { DefaultQuickAccessFilterValue } from 'vscode/vscode/vs/platform/quickinput/common/quickAccess';
21
+ import { IQuickInputService } from 'vscode/vscode/vs/platform/quickinput/common/quickInput';
22
+ import { IStorageService } from 'vscode/vscode/vs/platform/storage/common/storage';
23
+ import { ITelemetryService } from 'vscode/vscode/vs/platform/telemetry/common/telemetry';
24
+ import { CHAT_OPEN_ACTION_ID } from 'vscode/vscode/vs/workbench/contrib/chat/browser/actions/chatActions';
25
+ import { ASK_QUICK_QUESTION_ACTION_ID } from 'vscode/vscode/vs/workbench/contrib/chat/browser/actions/chatQuickInputActions';
26
+ import { ChatAgentLocation, IChatAgentService } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatAgents';
27
+ import { RelatedInformationType, IAiRelatedInformationService } from 'vscode/vscode/vs/workbench/services/aiRelatedInformation/common/aiRelatedInformation';
28
+ import { IEditorGroupsService } from 'vscode/vscode/vs/workbench/services/editor/common/editorGroupsService';
29
+ import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService';
30
+ import { IExtensionService } from 'vscode/vscode/vs/workbench/services/extensions/common/extensions';
31
+ import { IPreferencesService } from 'vscode/vscode/vs/workbench/services/preferences/common/preferences';
32
+ import { IDialogService } from 'vscode/vscode/vs/platform/dialogs/common/dialogs';
33
+
34
+ var CommandsQuickAccessProvider_1;
35
+ let CommandsQuickAccessProvider = class CommandsQuickAccessProvider extends AbstractEditorCommandsQuickAccessProvider {
36
+ static { CommandsQuickAccessProvider_1 = this; }
37
+ static { this.AI_RELATED_INFORMATION_MAX_PICKS = 5; }
38
+ static { this.AI_RELATED_INFORMATION_THRESHOLD = 0.8; }
39
+ static { this.AI_RELATED_INFORMATION_DEBOUNCE = 200; }
40
+ get activeTextEditorControl() { return this.editorService.activeTextEditorControl; }
41
+ get defaultFilterValue() {
42
+ if (this.configuration.preserveInput) {
43
+ return DefaultQuickAccessFilterValue.LAST;
44
+ }
45
+ return undefined;
46
+ }
47
+ constructor(editorService, menuService, extensionService, instantiationService, keybindingService, commandService, telemetryService, dialogService, configurationService, editorGroupService, preferencesService, productService, aiRelatedInformationService, chatAgentService) {
48
+ super({
49
+ showAlias: !Language.isDefaultVariant(),
50
+ noResultsPick: () => ({
51
+ label: ( localizeWithPath(
52
+ 'vs/workbench/contrib/quickaccess/browser/commandsQuickAccess',
53
+ 'noCommandResults',
54
+ "No matching commands"
55
+ )),
56
+ commandId: ''
57
+ }),
58
+ }, instantiationService, keybindingService, commandService, telemetryService, dialogService);
59
+ this.editorService = editorService;
60
+ this.menuService = menuService;
61
+ this.extensionService = extensionService;
62
+ this.configurationService = configurationService;
63
+ this.editorGroupService = editorGroupService;
64
+ this.preferencesService = preferencesService;
65
+ this.productService = productService;
66
+ this.aiRelatedInformationService = aiRelatedInformationService;
67
+ this.chatAgentService = chatAgentService;
68
+ this.extensionRegistrationRace = raceTimeout(this.extensionService.whenInstalledExtensionsRegistered(), 800);
69
+ this.useAiRelatedInfo = false;
70
+ this._register(configurationService.onDidChangeConfiguration((e) => this.updateOptions(e)));
71
+ this.updateOptions();
72
+ }
73
+ get configuration() {
74
+ const commandPaletteConfig = this.configurationService.getValue().workbench.commandPalette;
75
+ return {
76
+ preserveInput: commandPaletteConfig.preserveInput,
77
+ experimental: commandPaletteConfig.experimental
78
+ };
79
+ }
80
+ updateOptions(e) {
81
+ if (e && !e.affectsConfiguration('workbench.commandPalette.experimental')) {
82
+ return;
83
+ }
84
+ const config = this.configuration;
85
+ const suggestedCommandIds = config.experimental.suggestCommands && this.productService.commandPaletteSuggestedCommandIds?.length
86
+ ? ( new Set(this.productService.commandPaletteSuggestedCommandIds))
87
+ : undefined;
88
+ this.options.suggestedCommandIds = suggestedCommandIds;
89
+ this.useAiRelatedInfo = config.experimental.enableNaturalLanguageSearch;
90
+ }
91
+ async getCommandPicks(token) {
92
+ await this.extensionRegistrationRace;
93
+ if (token.isCancellationRequested) {
94
+ return [];
95
+ }
96
+ return ( [
97
+ ...this.getCodeEditorCommandPicks(),
98
+ ...this.getGlobalCommandPicks()
99
+ ].map(picks => ({
100
+ ...picks,
101
+ buttons: [{
102
+ iconClass: ThemeIcon.asClassName(Codicon.gear),
103
+ tooltip: ( localizeWithPath(
104
+ 'vs/workbench/contrib/quickaccess/browser/commandsQuickAccess',
105
+ 'configure keybinding',
106
+ "Configure Keybinding"
107
+ )),
108
+ }],
109
+ trigger: () => {
110
+ this.preferencesService.openGlobalKeybindingSettings(false, { query: `@command:${picks.commandId}` });
111
+ return TriggerAction.CLOSE_PICKER;
112
+ },
113
+ })));
114
+ }
115
+ hasAdditionalCommandPicks(filter, token) {
116
+ if (!this.useAiRelatedInfo
117
+ || token.isCancellationRequested
118
+ || filter === ''
119
+ || !this.aiRelatedInformationService.isEnabled()) {
120
+ return false;
121
+ }
122
+ return true;
123
+ }
124
+ async getAdditionalCommandPicks(allPicks, picksSoFar, filter, token) {
125
+ if (!this.hasAdditionalCommandPicks(filter, token)) {
126
+ return [];
127
+ }
128
+ let additionalPicks;
129
+ try {
130
+ await timeout(CommandsQuickAccessProvider_1.AI_RELATED_INFORMATION_DEBOUNCE, token);
131
+ additionalPicks = await this.getRelatedInformationPicks(allPicks, picksSoFar, filter, token);
132
+ }
133
+ catch (e) {
134
+ return [];
135
+ }
136
+ if (picksSoFar.length || additionalPicks.length) {
137
+ additionalPicks.push({
138
+ type: 'separator'
139
+ });
140
+ }
141
+ const defaultAgent = this.chatAgentService.getDefaultAgent(ChatAgentLocation.Panel);
142
+ if (defaultAgent) {
143
+ additionalPicks.push({
144
+ label: ( localizeWithPath(
145
+ 'vs/workbench/contrib/quickaccess/browser/commandsQuickAccess',
146
+ 'askXInChat',
147
+ "Ask {0}: {1}",
148
+ defaultAgent.metadata.fullName,
149
+ filter
150
+ )),
151
+ commandId: this.configuration.experimental.askChatLocation === 'quickChat' ? ASK_QUICK_QUESTION_ACTION_ID : CHAT_OPEN_ACTION_ID,
152
+ args: [filter]
153
+ });
154
+ }
155
+ return additionalPicks;
156
+ }
157
+ async getRelatedInformationPicks(allPicks, picksSoFar, filter, token) {
158
+ const relatedInformation = await this.aiRelatedInformationService.getRelatedInformation(filter, [RelatedInformationType.CommandInformation], token);
159
+ relatedInformation.sort((a, b) => b.weight - a.weight);
160
+ const setOfPicksSoFar = ( new Set(( picksSoFar.map(p => p.commandId))));
161
+ const additionalPicks = ( new Array());
162
+ for (const info of relatedInformation) {
163
+ if (info.weight < CommandsQuickAccessProvider_1.AI_RELATED_INFORMATION_THRESHOLD || additionalPicks.length === CommandsQuickAccessProvider_1.AI_RELATED_INFORMATION_MAX_PICKS) {
164
+ break;
165
+ }
166
+ const pick = allPicks.find(p => p.commandId === info.command && !( setOfPicksSoFar.has(p.commandId)));
167
+ if (pick) {
168
+ additionalPicks.push(pick);
169
+ }
170
+ }
171
+ return additionalPicks;
172
+ }
173
+ getGlobalCommandPicks() {
174
+ const globalCommandPicks = [];
175
+ const scopedContextKeyService = this.editorService.activeEditorPane?.scopedContextKeyService || this.editorGroupService.activeGroup.scopedContextKeyService;
176
+ const globalCommandsMenu = this.menuService.createMenu(MenuId.CommandPalette, scopedContextKeyService);
177
+ const globalCommandsMenuActions = globalCommandsMenu.getActions()
178
+ .reduce((r, [, actions]) => [...r, ...actions], [])
179
+ .filter(action => action instanceof MenuItemAction && action.enabled);
180
+ for (const action of globalCommandsMenuActions) {
181
+ let label = (typeof action.item.title === 'string' ? action.item.title : action.item.title.value) || action.item.id;
182
+ const category = typeof action.item.category === 'string' ? action.item.category : action.item.category?.value;
183
+ if (category) {
184
+ label = ( localizeWithPath(
185
+ 'vs/workbench/contrib/quickaccess/browser/commandsQuickAccess',
186
+ 'commandWithCategory',
187
+ "{0}: {1}",
188
+ category,
189
+ label
190
+ ));
191
+ }
192
+ const aliasLabel = typeof action.item.title !== 'string' ? action.item.title.original : undefined;
193
+ const aliasCategory = (category && action.item.category && typeof action.item.category !== 'string') ? action.item.category.original : undefined;
194
+ const commandAlias = (aliasLabel && category) ?
195
+ aliasCategory ? `${aliasCategory}: ${aliasLabel}` : `${category}: ${aliasLabel}` :
196
+ aliasLabel;
197
+ const metadataDescription = action.item.metadata?.description;
198
+ const commandDescription = metadataDescription === undefined || isLocalizedString(metadataDescription)
199
+ ? metadataDescription
200
+ : { value: metadataDescription, original: metadataDescription };
201
+ globalCommandPicks.push({
202
+ commandId: action.item.id,
203
+ commandAlias,
204
+ label: stripIcons(label),
205
+ commandDescription,
206
+ });
207
+ }
208
+ globalCommandsMenu.dispose();
209
+ return globalCommandPicks;
210
+ }
211
+ };
212
+ CommandsQuickAccessProvider = CommandsQuickAccessProvider_1 = ( __decorate([
213
+ ( __param(0, IEditorService)),
214
+ ( __param(1, IMenuService)),
215
+ ( __param(2, IExtensionService)),
216
+ ( __param(3, IInstantiationService)),
217
+ ( __param(4, IKeybindingService)),
218
+ ( __param(5, ICommandService)),
219
+ ( __param(6, ITelemetryService)),
220
+ ( __param(7, IDialogService)),
221
+ ( __param(8, IConfigurationService)),
222
+ ( __param(9, IEditorGroupsService)),
223
+ ( __param(10, IPreferencesService)),
224
+ ( __param(11, IProductService)),
225
+ ( __param(12, IAiRelatedInformationService)),
226
+ ( __param(13, IChatAgentService))
227
+ ], CommandsQuickAccessProvider));
228
+ class ShowAllCommandsAction extends Action2 {
229
+ static { this.ID = 'workbench.action.showCommands'; }
230
+ constructor() {
231
+ super({
232
+ id: ShowAllCommandsAction.ID,
233
+ title: ( localize2WithPath(
234
+ 'vs/workbench/contrib/quickaccess/browser/commandsQuickAccess',
235
+ 'showTriggerActions',
236
+ 'Show All Commands'
237
+ )),
238
+ keybinding: {
239
+ weight: 200 ,
240
+ when: undefined,
241
+ primary: !isFirefox ? ((2048 | 1024 | 46) ) : undefined,
242
+ secondary: [59 ]
243
+ },
244
+ f1: true
245
+ });
246
+ }
247
+ async run(accessor) {
248
+ accessor.get(IQuickInputService).quickAccess.show(CommandsQuickAccessProvider.PREFIX);
249
+ }
250
+ }
251
+ class ClearCommandHistoryAction extends Action2 {
252
+ constructor() {
253
+ super({
254
+ id: 'workbench.action.clearCommandHistory',
255
+ title: ( localize2WithPath(
256
+ 'vs/workbench/contrib/quickaccess/browser/commandsQuickAccess',
257
+ 'clearCommandHistory',
258
+ 'Clear Command History'
259
+ )),
260
+ f1: true
261
+ });
262
+ }
263
+ async run(accessor) {
264
+ const configurationService = accessor.get(IConfigurationService);
265
+ const storageService = accessor.get(IStorageService);
266
+ const dialogService = accessor.get(IDialogService);
267
+ const commandHistoryLength = CommandsHistory.getConfiguredCommandHistoryLength(configurationService);
268
+ if (commandHistoryLength > 0) {
269
+ const { confirmed } = await dialogService.confirm({
270
+ type: 'warning',
271
+ message: ( localizeWithPath(
272
+ 'vs/workbench/contrib/quickaccess/browser/commandsQuickAccess',
273
+ 'confirmClearMessage',
274
+ "Do you want to clear the history of recently used commands?"
275
+ )),
276
+ detail: ( localizeWithPath(
277
+ 'vs/workbench/contrib/quickaccess/browser/commandsQuickAccess',
278
+ 'confirmClearDetail',
279
+ "This action is irreversible!"
280
+ )),
281
+ primaryButton: ( localizeWithPath(
282
+ 'vs/workbench/contrib/quickaccess/browser/commandsQuickAccess',
283
+ { key: 'clearButtonLabel', comment: ['&& denotes a mnemonic'] },
284
+ "&&Clear"
285
+ ))
286
+ });
287
+ if (!confirmed) {
288
+ return;
289
+ }
290
+ CommandsHistory.clearHistory(configurationService, storageService);
291
+ }
292
+ }
293
+ }
294
+
295
+ export { ClearCommandHistoryAction, CommandsQuickAccessProvider, ShowAllCommandsAction };