@codingame/monaco-vscode-api 1.68.7 → 1.69.0

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,2352 @@
1
+ import { _ as __decorate, a as __param } from './tslib.es6.js';
2
+ import { a as isProposedApiEnabled, J as IUserDataProfileService, I as IExtensionService, K as IKeyboardLayoutService, L as IPreferencesService, M as ExtensionsRegistry, O as ExtensionMessageCollector, k as IUserDataProfilesService, E as Emitter, P as parse } from './missing-services.js';
3
+ import { KeyCodeUtils, IMMUTABLE_CODE_TO_KEY_CODE } from 'monaco-editor/esm/vs/base/common/keyCodes.js';
4
+ import { SimpleKeybinding, ScanCodeBinding, ChordKeybinding } from 'monaco-editor/esm/vs/base/common/keybindings.js';
5
+ import { ContextKeyExpr, IContextKeyService } from 'monaco-editor/esm/vs/platform/contextkey/common/contextkey.js';
6
+ import { l as IHostService, I as IFileService, c as IEditorService, f as IEditorGroupsService, W as index, S as Services, X as flatten } from './services2.js';
7
+ import { MenuRegistry, MenuId, MenuItemAction, IMenuService, isIMenuItem } from 'monaco-editor/esm/vs/platform/actions/common/actions.js';
8
+ import { getConfiguredDefaultLocale, localize } from 'monaco-editor/esm/vs/nls.js';
9
+ import { ThemeIcon } from 'monaco-editor/esm/vs/platform/theme/common/themeService.js';
10
+ import { joinPath, dirname } from 'monaco-editor/esm/vs/base/common/resources.js';
11
+ import { Iterable } from 'monaco-editor/esm/vs/base/common/iterator.js';
12
+ import { DisposableStore, toDisposable, dispose, Disposable } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
13
+ import { isFalsyOrWhitespace } from 'monaco-editor/esm/vs/base/common/strings.js';
14
+ import { EditorExtensionsRegistry } from 'monaco-editor/esm/vs/editor/browser/editorExtensions.js';
15
+ import { ICommandService, CommandsRegistry } from 'monaco-editor/esm/vs/platform/commands/common/commands.js';
16
+ import { isNonEmptyArray } from 'monaco-editor/esm/vs/base/common/arrays.js';
17
+ import { AbstractKeybindingService } from 'monaco-editor/esm/vs/platform/keybinding/common/abstractKeybindingService.js';
18
+ import { KeybindingsRegistry } from 'monaco-editor/esm/vs/platform/keybinding/common/keybindingsRegistry.js';
19
+ import { addDisposableListener, EventType } from 'monaco-editor/esm/vs/base/browser/dom.js';
20
+ import { BrowserFeatures } from 'monaco-editor/esm/vs/base/browser/canIUse.js';
21
+ import { UserSettingsLabelProvider } from 'monaco-editor/esm/vs/base/common/keybindingLabels.js';
22
+ import { OS, isMacintosh } from 'monaco-editor/esm/vs/base/common/platform.js';
23
+ import { KeybindingResolver } from 'monaco-editor/esm/vs/platform/keybinding/common/keybindingResolver.js';
24
+ import { ResolvedKeybindingItem } from 'monaco-editor/esm/vs/platform/keybinding/common/resolvedKeybindingItem.js';
25
+ import { ITelemetryService } from 'monaco-editor/esm/vs/platform/telemetry/common/telemetry.js';
26
+ import { INotificationService } from 'monaco-editor/esm/vs/platform/notification/common/notification.js';
27
+ import { IConfigurationService } from 'monaco-editor/esm/vs/platform/configuration/common/configuration.js';
28
+ import { ILogService } from 'monaco-editor/esm/vs/platform/log/common/log.js';
29
+ import { timeout, RunOnceScheduler } from 'monaco-editor/esm/vs/base/common/async.js';
30
+ import { Event } from 'monaco-editor/esm/vs/base/common/event.js';
31
+ import { isArray } from 'monaco-editor/esm/vs/base/common/types.js';
32
+ import { equals } from 'monaco-editor/esm/vs/base/common/objects.js';
33
+ import { StandardKeyboardEvent } from 'monaco-editor/esm/vs/base/browser/keyboardEvent.js';
34
+ import { Registry } from 'monaco-editor/esm/vs/platform/registry/common/platform.js';
35
+ import { Extensions } from 'monaco-editor/esm/vs/platform/jsonschemas/common/jsonContributionRegistry.js';
36
+ import { Extensions as Extensions$1 } from 'monaco-editor/esm/vs/platform/configuration/common/configurationRegistry.js';
37
+ import { AbstractEditorCommandsQuickAccessProvider } from 'monaco-editor/esm/vs/editor/contrib/quickAccess/browser/commandsQuickAccess.js';
38
+ import { DefaultQuickAccessFilterValue, Extensions as Extensions$2 } from 'monaco-editor/esm/vs/platform/quickinput/common/quickAccess.js';
39
+ import { Codicon } from 'monaco-editor/esm/vs/base/common/codicons.js';
40
+ import { TriggerAction } from 'monaco-editor/esm/vs/platform/quickinput/browser/pickerQuickAccess.js';
41
+ import { stripIcons } from 'monaco-editor/esm/vs/base/common/iconLabels.js';
42
+ import { IInstantiationService } from 'monaco-editor/esm/vs/platform/instantiation/common/instantiation.js';
43
+ import { IKeybindingService } from 'monaco-editor/esm/vs/platform/keybinding/common/keybinding.js';
44
+ import { IDialogService } from 'monaco-editor/esm/vs/platform/dialogs/common/dialogs.js';
45
+ import { g as getServiceOverride$1 } from './files.js';
46
+ import { g as getExtensionPoint, c as consoleExtensionMessageHandler } from './tools.js';
47
+ import { bd as DEFAULT_EXTENSION } from './extHost.js';
48
+ import { c as createInjectedClass } from './injection.js';
49
+ import { StandaloneCommandsQuickAccessProvider } from 'monaco-editor/esm/vs/editor/standalone/browser/quickAccess/standaloneCommandsQuickAccess.js';
50
+ import { SyncDescriptor } from 'monaco-editor/esm/vs/platform/instantiation/common/descriptors.js';
51
+ import { StandaloneServices, StandaloneKeybindingService } from 'monaco-editor/esm/vs/editor/standalone/browser/standaloneServices.js';
52
+ import { VSBuffer } from 'monaco-editor/esm/vs/base/common/buffer.js';
53
+ class WindowManager {
54
+ constructor() {
55
+ this._zoomLevel = 0;
56
+ this._zoomFactor = 1;
57
+ this._fullscreen = false;
58
+ this._onDidChangeFullscreen = ( (new Emitter()));
59
+ this.onDidChangeFullscreen = this._onDidChangeFullscreen.event;
60
+ }
61
+ getZoomLevel() {
62
+ return this._zoomLevel;
63
+ }
64
+ setZoomLevel(zoomLevel, isTrusted) {
65
+ if (this._zoomLevel === zoomLevel) {
66
+ return;
67
+ }
68
+ this._zoomLevel = zoomLevel;
69
+ }
70
+ getZoomFactor() {
71
+ return this._zoomFactor;
72
+ }
73
+ setZoomFactor(zoomFactor) {
74
+ this._zoomFactor = zoomFactor;
75
+ }
76
+ setFullscreen(fullscreen) {
77
+ if (this._fullscreen === fullscreen) {
78
+ return;
79
+ }
80
+ this._fullscreen = fullscreen;
81
+ this._onDidChangeFullscreen.fire();
82
+ }
83
+ isFullscreen() {
84
+ return this._fullscreen;
85
+ }
86
+ }
87
+ WindowManager.INSTANCE = ( (new WindowManager()));
88
+ function addMatchMediaChangeListener(query, callback) {
89
+ if (typeof query === 'string') {
90
+ query = window.matchMedia(query);
91
+ }
92
+ query.addEventListener('change', callback);
93
+ }
94
+ function isFullscreen() {
95
+ return WindowManager.INSTANCE.isFullscreen();
96
+ }
97
+ const onDidChangeFullscreen = WindowManager.INSTANCE.onDidChangeFullscreen;
98
+ const userAgent$1 = navigator.userAgent;
99
+ (userAgent$1.indexOf('Firefox') >= 0);
100
+ (userAgent$1.indexOf('AppleWebKit') >= 0);
101
+ const isChrome$1 = (userAgent$1.indexOf('Chrome') >= 0);
102
+ (!isChrome$1 && (userAgent$1.indexOf('Safari') >= 0));
103
+ (userAgent$1.indexOf('Electron/') >= 0);
104
+ (userAgent$1.indexOf('Android') >= 0);
105
+ if (window.matchMedia) {
106
+ const matchMedia = window.matchMedia('(display-mode: standalone)');
107
+ addMatchMediaChangeListener(matchMedia, ({ matches }) => {
108
+ });
109
+ }
110
+ const LANGUAGE_DEFAULT = 'en';
111
+ let _locale = undefined;
112
+ let _language = LANGUAGE_DEFAULT;
113
+ let _userAgent = undefined;
114
+ const globals = (typeof self === 'object' ? self : typeof global === 'object' ? global : {});
115
+ let nodeProcess = undefined;
116
+ if (typeof globals.vscode !== 'undefined' && typeof globals.vscode.process !== 'undefined') {
117
+ nodeProcess = globals.vscode.process;
118
+ }
119
+ else if (typeof process !== 'undefined') {
120
+ nodeProcess = process;
121
+ }
122
+ const isElectronProcess = typeof nodeProcess?.versions?.electron === 'string';
123
+ const isElectronRenderer = isElectronProcess && nodeProcess?.type === 'renderer';
124
+ if (typeof navigator === 'object' && !isElectronRenderer) {
125
+ _userAgent = navigator.userAgent;
126
+ _userAgent.indexOf('Windows') >= 0;
127
+ _userAgent.indexOf('Macintosh') >= 0;
128
+ (_userAgent.indexOf('Macintosh') >= 0 || _userAgent.indexOf('iPad') >= 0 || _userAgent.indexOf('iPhone') >= 0) && !!navigator.maxTouchPoints && navigator.maxTouchPoints > 0;
129
+ _userAgent.indexOf('Linux') >= 0;
130
+ const configuredLocale = getConfiguredDefaultLocale(
131
+ ( (localize({ key: 'ensureLoaderPluginIsLoaded', comment: ['{Locked}'] }, '_'))));
132
+ _locale = configuredLocale || LANGUAGE_DEFAULT;
133
+ _language = _locale;
134
+ }
135
+ else if (typeof nodeProcess === 'object') {
136
+ _locale = LANGUAGE_DEFAULT;
137
+ _language = LANGUAGE_DEFAULT;
138
+ const rawNlsConfig = nodeProcess.env['VSCODE_NLS_CONFIG'];
139
+ if (rawNlsConfig) {
140
+ try {
141
+ const nlsConfig = JSON.parse(rawNlsConfig);
142
+ const resolved = nlsConfig.availableLanguages['*'];
143
+ _locale = nlsConfig.locale;
144
+ _language = resolved ? resolved : LANGUAGE_DEFAULT;
145
+ }
146
+ catch (e) {
147
+ }
148
+ }
149
+ }
150
+ else {
151
+ console.error('Unable to resolve platform.');
152
+ }
153
+ const userAgent = _userAgent;
154
+ const language = _language;
155
+ var Language;
156
+ ( ((function(Language) {
157
+ function value() {
158
+ return language;
159
+ }
160
+ Language.value = value;
161
+ function isDefaultVariant() {
162
+ if (language.length === 2) {
163
+ return language === 'en';
164
+ }
165
+ else if (language.length >= 3) {
166
+ return language[0] === 'e' && language[1] === 'n' && language[2] === '-';
167
+ }
168
+ else {
169
+ return false;
170
+ }
171
+ }
172
+ Language.isDefaultVariant = isDefaultVariant;
173
+ function isDefault() {
174
+ return language === 'en';
175
+ }
176
+ Language.isDefault = isDefault;
177
+ })(Language || (Language = {}))));
178
+ const setTimeout0IsFaster = (typeof globals.postMessage === 'function' && !globals.importScripts);
179
+ (() => {
180
+ if (setTimeout0IsFaster) {
181
+ const pending = [];
182
+ globals.addEventListener('message', (e) => {
183
+ if (e.data && e.data.vscodeScheduleAsyncWork) {
184
+ for (let i = 0, len = pending.length; i < len; i++) {
185
+ const candidate = pending[i];
186
+ if (candidate.id === e.data.vscodeScheduleAsyncWork) {
187
+ pending.splice(i, 1);
188
+ candidate.callback();
189
+ return;
190
+ }
191
+ }
192
+ }
193
+ });
194
+ let lastId = 0;
195
+ return (callback) => {
196
+ const myId = ++lastId;
197
+ pending.push({
198
+ id: myId,
199
+ callback: callback
200
+ });
201
+ globals.postMessage({ vscodeScheduleAsyncWork: myId }, '*');
202
+ };
203
+ }
204
+ return (callback) => setTimeout(callback);
205
+ })();
206
+ const isChrome = !!(userAgent && userAgent.indexOf('Chrome') >= 0);
207
+ !!(userAgent && userAgent.indexOf('Firefox') >= 0);
208
+ !!(!isChrome && (userAgent && userAgent.indexOf('Safari') >= 0));
209
+ !!(userAgent && userAgent.indexOf('Edg/') >= 0);
210
+ !!(userAgent && userAgent.indexOf('Android') >= 0);
211
+ const scanCodeIntToStr = [];
212
+ const scanCodeStrToInt = Object.create(null);
213
+ const scanCodeLowerCaseStrToInt = Object.create(null);
214
+ const ScanCodeUtils = {
215
+ lowerCaseToEnum: (scanCode) => scanCodeLowerCaseStrToInt[scanCode] || 0 ,
216
+ toEnum: (scanCode) => scanCodeStrToInt[scanCode] || 0 ,
217
+ toString: (scanCode) => scanCodeIntToStr[scanCode] || 'None'
218
+ };
219
+ function printKeyboardEvent(e) {
220
+ const modifiers = [];
221
+ if (e.ctrlKey) {
222
+ modifiers.push(`ctrl`);
223
+ }
224
+ if (e.shiftKey) {
225
+ modifiers.push(`shift`);
226
+ }
227
+ if (e.altKey) {
228
+ modifiers.push(`alt`);
229
+ }
230
+ if (e.metaKey) {
231
+ modifiers.push(`meta`);
232
+ }
233
+ return `modifiers: [${modifiers.join(',')}], code: ${e.code}, keyCode: ${e.keyCode}, key: ${e.key}`;
234
+ }
235
+ function printStandardKeyboardEvent(e) {
236
+ const modifiers = [];
237
+ if (e.ctrlKey) {
238
+ modifiers.push(`ctrl`);
239
+ }
240
+ if (e.shiftKey) {
241
+ modifiers.push(`shift`);
242
+ }
243
+ if (e.altKey) {
244
+ modifiers.push(`alt`);
245
+ }
246
+ if (e.metaKey) {
247
+ modifiers.push(`meta`);
248
+ }
249
+ return `modifiers: [${modifiers.join(',')}], code: ${e.code}, keyCode: ${e.keyCode} ('${( ( KeyCodeUtils.toString(e.keyCode)))}')`;
250
+ }
251
+ const apiMenus = [
252
+ {
253
+ key: 'commandPalette',
254
+ id: MenuId.CommandPalette,
255
+ description: ( (localize('menus.commandPalette', "The Command Palette"))),
256
+ supportsSubmenus: false
257
+ },
258
+ {
259
+ key: 'touchBar',
260
+ id: MenuId.TouchBarContext,
261
+ description: ( (localize('menus.touchBar', "The touch bar (macOS only)"))),
262
+ supportsSubmenus: false
263
+ },
264
+ {
265
+ key: 'editor/title',
266
+ id: MenuId.EditorTitle,
267
+ description: ( (localize('menus.editorTitle', "The editor title menu")))
268
+ },
269
+ {
270
+ key: 'editor/title/run',
271
+ id: MenuId.EditorTitleRun,
272
+ description: ( (localize('menus.editorTitleRun', "Run submenu inside the editor title menu")))
273
+ },
274
+ {
275
+ key: 'editor/context',
276
+ id: MenuId.EditorContext,
277
+ description: ( (localize('menus.editorContext', "The editor context menu")))
278
+ },
279
+ {
280
+ key: 'editor/context/copy',
281
+ id: MenuId.EditorContextCopy,
282
+ description: ( (localize(
283
+ 'menus.editorContextCopyAs',
284
+ "'Copy as' submenu in the editor context menu"
285
+ )))
286
+ },
287
+ {
288
+ key: 'editor/context/share',
289
+ id: MenuId.EditorContextShare,
290
+ description: ( (localize('menus.editorContextShare', "'Share' submenu in the editor context menu"))),
291
+ proposed: 'contribShareMenu'
292
+ },
293
+ {
294
+ key: 'explorer/context',
295
+ id: MenuId.ExplorerContext,
296
+ description: ( (localize('menus.explorerContext', "The file explorer context menu")))
297
+ },
298
+ {
299
+ key: 'editor/title/context',
300
+ id: MenuId.EditorTitleContext,
301
+ description: ( (localize('menus.editorTabContext', "The editor tabs context menu")))
302
+ },
303
+ {
304
+ key: 'debug/callstack/context',
305
+ id: MenuId.DebugCallStackContext,
306
+ description: ( (localize('menus.debugCallstackContext', "The debug callstack view context menu")))
307
+ },
308
+ {
309
+ key: 'debug/variables/context',
310
+ id: MenuId.DebugVariablesContext,
311
+ description: ( (localize('menus.debugVariablesContext', "The debug variables view context menu")))
312
+ },
313
+ {
314
+ key: 'debug/toolBar',
315
+ id: MenuId.DebugToolBar,
316
+ description: ( (localize('menus.debugToolBar', "The debug toolbar menu")))
317
+ },
318
+ {
319
+ key: 'menuBar/home',
320
+ id: MenuId.MenubarHomeMenu,
321
+ description: ( (localize('menus.home', "The home indicator context menu (web only)"))),
322
+ proposed: 'contribMenuBarHome',
323
+ supportsSubmenus: false
324
+ },
325
+ {
326
+ key: 'menuBar/edit/copy',
327
+ id: MenuId.MenubarCopy,
328
+ description: ( (localize('menus.opy', "'Copy as' submenu in the top level Edit menu")))
329
+ },
330
+ {
331
+ key: 'scm/title',
332
+ id: MenuId.SCMTitle,
333
+ description: ( (localize('menus.scmTitle', "The Source Control title menu")))
334
+ },
335
+ {
336
+ key: 'scm/sourceControl',
337
+ id: MenuId.SCMSourceControl,
338
+ description: ( (localize('menus.scmSourceControl', "The Source Control menu")))
339
+ },
340
+ {
341
+ key: 'scm/resourceState/context',
342
+ id: MenuId.SCMResourceContext,
343
+ description: ( (localize(
344
+ 'menus.resourceStateContext',
345
+ "The Source Control resource state context menu"
346
+ )))
347
+ },
348
+ {
349
+ key: 'scm/resourceFolder/context',
350
+ id: MenuId.SCMResourceFolderContext,
351
+ description: ( (localize(
352
+ 'menus.resourceFolderContext',
353
+ "The Source Control resource folder context menu"
354
+ )))
355
+ },
356
+ {
357
+ key: 'scm/resourceGroup/context',
358
+ id: MenuId.SCMResourceGroupContext,
359
+ description: ( (localize(
360
+ 'menus.resourceGroupContext',
361
+ "The Source Control resource group context menu"
362
+ )))
363
+ },
364
+ {
365
+ key: 'scm/change/title',
366
+ id: MenuId.SCMChangeContext,
367
+ description: ( (localize('menus.changeTitle', "The Source Control inline change menu")))
368
+ },
369
+ {
370
+ key: 'statusBar/remoteIndicator',
371
+ id: MenuId.StatusBarRemoteIndicatorMenu,
372
+ description: ( (localize(
373
+ 'menus.statusBarRemoteIndicator',
374
+ "The remote indicator menu in the status bar"
375
+ ))),
376
+ supportsSubmenus: false
377
+ },
378
+ {
379
+ key: 'view/title',
380
+ id: MenuId.ViewTitle,
381
+ description: ( (localize('view.viewTitle', "The contributed view title menu")))
382
+ },
383
+ {
384
+ key: 'view/item/context',
385
+ id: MenuId.ViewItemContext,
386
+ description: ( (localize('view.itemContext', "The contributed view item context menu")))
387
+ },
388
+ {
389
+ key: 'comments/commentThread/title',
390
+ id: MenuId.CommentThreadTitle,
391
+ description: ( (localize('commentThread.title', "The contributed comment thread title menu")))
392
+ },
393
+ {
394
+ key: 'comments/commentThread/context',
395
+ id: MenuId.CommentThreadActions,
396
+ description: ( (localize(
397
+ 'commentThread.actions',
398
+ "The contributed comment thread context menu, rendered as buttons below the comment editor"
399
+ ))),
400
+ supportsSubmenus: false
401
+ },
402
+ {
403
+ key: 'comments/comment/title',
404
+ id: MenuId.CommentTitle,
405
+ description: ( (localize('comment.title', "The contributed comment title menu")))
406
+ },
407
+ {
408
+ key: 'comments/comment/context',
409
+ id: MenuId.CommentActions,
410
+ description: ( (localize(
411
+ 'comment.actions',
412
+ "The contributed comment context menu, rendered as buttons below the comment editor"
413
+ ))),
414
+ supportsSubmenus: false
415
+ },
416
+ {
417
+ key: 'notebook/toolbar',
418
+ id: MenuId.NotebookToolbar,
419
+ description: ( (localize('notebook.toolbar', "The contributed notebook toolbar menu")))
420
+ },
421
+ {
422
+ key: 'notebook/kernelSource',
423
+ id: MenuId.NotebookKernelSource,
424
+ description: ( (localize('notebook.kernelSource', "The contributed notebook kernel sources menu"))),
425
+ proposed: 'notebookKernelSource'
426
+ },
427
+ {
428
+ key: 'notebook/cell/title',
429
+ id: MenuId.NotebookCellTitle,
430
+ description: ( (localize('notebook.cell.title', "The contributed notebook cell title menu")))
431
+ },
432
+ {
433
+ key: 'notebook/cell/execute',
434
+ id: MenuId.NotebookCellExecute,
435
+ description: ( (localize('notebook.cell.execute', "The contributed notebook cell execution menu")))
436
+ },
437
+ {
438
+ key: 'notebook/cell/executePrimary',
439
+ id: MenuId.NotebookCellExecutePrimary,
440
+ description: ( (localize(
441
+ 'notebook.cell.executePrimary',
442
+ "The contributed primary notebook cell execution button"
443
+ ))),
444
+ proposed: 'notebookEditor'
445
+ },
446
+ {
447
+ key: 'interactive/toolbar',
448
+ id: MenuId.InteractiveToolbar,
449
+ description: ( (localize('interactive.toolbar', "The contributed interactive toolbar menu"))),
450
+ },
451
+ {
452
+ key: 'interactive/cell/title',
453
+ id: MenuId.InteractiveCellTitle,
454
+ description: ( (localize('interactive.cell.title', "The contributed interactive cell title menu"))),
455
+ },
456
+ {
457
+ key: 'testing/item/context',
458
+ id: MenuId.TestItem,
459
+ description: ( (localize('testing.item.context', "The contributed test item menu"))),
460
+ },
461
+ {
462
+ key: 'testing/item/gutter',
463
+ id: MenuId.TestItemGutter,
464
+ description: ( (localize(
465
+ 'testing.item.gutter.title',
466
+ "The menu for a gutter decoration for a test item"
467
+ ))),
468
+ },
469
+ {
470
+ key: 'extension/context',
471
+ id: MenuId.ExtensionContext,
472
+ description: ( (localize('menus.extensionContext', "The extension context menu")))
473
+ },
474
+ {
475
+ key: 'timeline/title',
476
+ id: MenuId.TimelineTitle,
477
+ description: ( (localize('view.timelineTitle', "The Timeline view title menu")))
478
+ },
479
+ {
480
+ key: 'timeline/item/context',
481
+ id: MenuId.TimelineItemContext,
482
+ description: ( (localize('view.timelineContext', "The Timeline view item context menu")))
483
+ },
484
+ {
485
+ key: 'ports/item/context',
486
+ id: MenuId.TunnelContext,
487
+ description: ( (localize('view.tunnelContext', "The Ports view item context menu")))
488
+ },
489
+ {
490
+ key: 'ports/item/origin/inline',
491
+ id: MenuId.TunnelOriginInline,
492
+ description: ( (localize('view.tunnelOriginInline', "The Ports view item origin inline menu")))
493
+ },
494
+ {
495
+ key: 'ports/item/port/inline',
496
+ id: MenuId.TunnelPortInline,
497
+ description: ( (localize('view.tunnelPortInline', "The Ports view item port inline menu")))
498
+ },
499
+ {
500
+ key: 'file/newFile',
501
+ id: MenuId.NewFile,
502
+ description: ( (localize(
503
+ 'file.newFile',
504
+ "The 'New File...' quick pick, shown on welcome page and File menu."
505
+ ))),
506
+ supportsSubmenus: false,
507
+ },
508
+ {
509
+ key: 'file/share',
510
+ id: MenuId.MenubarShare,
511
+ description: ( (localize('menus.share', "Share submenu shown in the top level File menu."))),
512
+ proposed: 'contribShareMenu'
513
+ },
514
+ {
515
+ key: 'editor/inlineCompletions/actions',
516
+ id: MenuId.InlineCompletionsActions,
517
+ description: ( (localize(
518
+ 'inlineCompletions.actions',
519
+ "The actions shown when hovering on an inline completion"
520
+ ))),
521
+ supportsSubmenus: false,
522
+ proposed: 'inlineCompletionsAdditions'
523
+ },
524
+ {
525
+ key: 'merge/toolbar',
526
+ id: MenuId.MergeToolbar,
527
+ description: ( (localize('merge.toolbar', "The prominent botton in the merge editor"))),
528
+ proposed: 'contribMergeEditorToolbar'
529
+ },
530
+ {
531
+ key: 'webview/context',
532
+ id: MenuId.WebviewContext,
533
+ description: ( (localize('webview.context', "The webview context menu"))),
534
+ proposed: 'contribWebviewContext'
535
+ },
536
+ ];
537
+ var schema$1;
538
+ ( ((function(schema) {
539
+ function isMenuItem(item) {
540
+ return typeof item.command === 'string';
541
+ }
542
+ schema.isMenuItem = isMenuItem;
543
+ function isValidMenuItem(item, collector) {
544
+ if (typeof item.command !== 'string') {
545
+ collector.error(( (localize(
546
+ 'requirestring',
547
+ "property `{0}` is mandatory and must be of type `string`",
548
+ 'command'
549
+ ))));
550
+ return false;
551
+ }
552
+ if (item.alt && typeof item.alt !== 'string') {
553
+ collector.error(( (localize(
554
+ 'optstring',
555
+ "property `{0}` can be omitted or must be of type `string`",
556
+ 'alt'
557
+ ))));
558
+ return false;
559
+ }
560
+ if (item.when && typeof item.when !== 'string') {
561
+ collector.error(( (localize(
562
+ 'optstring',
563
+ "property `{0}` can be omitted or must be of type `string`",
564
+ 'when'
565
+ ))));
566
+ return false;
567
+ }
568
+ if (item.group && typeof item.group !== 'string') {
569
+ collector.error(( (localize(
570
+ 'optstring',
571
+ "property `{0}` can be omitted or must be of type `string`",
572
+ 'group'
573
+ ))));
574
+ return false;
575
+ }
576
+ return true;
577
+ }
578
+ schema.isValidMenuItem = isValidMenuItem;
579
+ function isValidSubmenuItem(item, collector) {
580
+ if (typeof item.submenu !== 'string') {
581
+ collector.error(( (localize(
582
+ 'requirestring',
583
+ "property `{0}` is mandatory and must be of type `string`",
584
+ 'submenu'
585
+ ))));
586
+ return false;
587
+ }
588
+ if (item.when && typeof item.when !== 'string') {
589
+ collector.error(( (localize(
590
+ 'optstring',
591
+ "property `{0}` can be omitted or must be of type `string`",
592
+ 'when'
593
+ ))));
594
+ return false;
595
+ }
596
+ if (item.group && typeof item.group !== 'string') {
597
+ collector.error(( (localize(
598
+ 'optstring',
599
+ "property `{0}` can be omitted or must be of type `string`",
600
+ 'group'
601
+ ))));
602
+ return false;
603
+ }
604
+ return true;
605
+ }
606
+ schema.isValidSubmenuItem = isValidSubmenuItem;
607
+ function isValidItems(items, collector) {
608
+ if (!Array.isArray(items)) {
609
+ collector.error(( (localize('requirearray', "submenu items must be an array"))));
610
+ return false;
611
+ }
612
+ for (const item of items) {
613
+ if (isMenuItem(item)) {
614
+ if (!isValidMenuItem(item, collector)) {
615
+ return false;
616
+ }
617
+ }
618
+ else {
619
+ if (!isValidSubmenuItem(item, collector)) {
620
+ return false;
621
+ }
622
+ }
623
+ }
624
+ return true;
625
+ }
626
+ schema.isValidItems = isValidItems;
627
+ function isValidSubmenu(submenu, collector) {
628
+ if (typeof submenu !== 'object') {
629
+ collector.error(( (localize('require', "submenu items must be an object"))));
630
+ return false;
631
+ }
632
+ if (typeof submenu.id !== 'string') {
633
+ collector.error(( (localize(
634
+ 'requirestring',
635
+ "property `{0}` is mandatory and must be of type `string`",
636
+ 'id'
637
+ ))));
638
+ return false;
639
+ }
640
+ if (typeof submenu.label !== 'string') {
641
+ collector.error(( (localize(
642
+ 'requirestring',
643
+ "property `{0}` is mandatory and must be of type `string`",
644
+ 'label'
645
+ ))));
646
+ return false;
647
+ }
648
+ return true;
649
+ }
650
+ schema.isValidSubmenu = isValidSubmenu;
651
+ const menuItem = {
652
+ type: 'object',
653
+ required: ['command'],
654
+ properties: {
655
+ command: {
656
+ description: ( (localize(
657
+ 'vscode.extension.contributes.menuItem.command',
658
+ 'Identifier of the command to execute. The command must be declared in the \'commands\'-section'
659
+ ))),
660
+ type: 'string'
661
+ },
662
+ alt: {
663
+ description: ( (localize(
664
+ 'vscode.extension.contributes.menuItem.alt',
665
+ 'Identifier of an alternative command to execute. The command must be declared in the \'commands\'-section'
666
+ ))),
667
+ type: 'string'
668
+ },
669
+ when: {
670
+ description: ( (localize(
671
+ 'vscode.extension.contributes.menuItem.when',
672
+ 'Condition which must be true to show this item'
673
+ ))),
674
+ type: 'string'
675
+ },
676
+ group: {
677
+ description: ( (localize(
678
+ 'vscode.extension.contributes.menuItem.group',
679
+ 'Group into which this item belongs'
680
+ ))),
681
+ type: 'string'
682
+ }
683
+ }
684
+ };
685
+ const submenuItem = {
686
+ type: 'object',
687
+ required: ['submenu'],
688
+ properties: {
689
+ submenu: {
690
+ description: ( (localize(
691
+ 'vscode.extension.contributes.menuItem.submenu',
692
+ 'Identifier of the submenu to display in this item.'
693
+ ))),
694
+ type: 'string'
695
+ },
696
+ when: {
697
+ description: ( (localize(
698
+ 'vscode.extension.contributes.menuItem.when',
699
+ 'Condition which must be true to show this item'
700
+ ))),
701
+ type: 'string'
702
+ },
703
+ group: {
704
+ description: ( (localize(
705
+ 'vscode.extension.contributes.menuItem.group',
706
+ 'Group into which this item belongs'
707
+ ))),
708
+ type: 'string'
709
+ }
710
+ }
711
+ };
712
+ const submenu = {
713
+ type: 'object',
714
+ required: ['id', 'label'],
715
+ properties: {
716
+ id: {
717
+ description: ( (localize(
718
+ 'vscode.extension.contributes.submenu.id',
719
+ 'Identifier of the menu to display as a submenu.'
720
+ ))),
721
+ type: 'string'
722
+ },
723
+ label: {
724
+ description: ( (localize(
725
+ 'vscode.extension.contributes.submenu.label',
726
+ 'The label of the menu item which leads to this submenu.'
727
+ ))),
728
+ type: 'string'
729
+ },
730
+ icon: {
731
+ description: ( (localize(
732
+ { key: 'vscode.extension.contributes.submenu.icon', comment: ['do not translate or change `\\$(zap)`, \\ in front of $ is important.'] },
733
+ '(Optional) Icon which is used to represent the submenu in the UI. Either a file path, an object with file paths for dark and light themes, or a theme icon references, like `\\$(zap)`'
734
+ ))),
735
+ anyOf: [{
736
+ type: 'string'
737
+ },
738
+ {
739
+ type: 'object',
740
+ properties: {
741
+ light: {
742
+ description: ( (localize(
743
+ 'vscode.extension.contributes.submenu.icon.light',
744
+ 'Icon path when a light theme is used'
745
+ ))),
746
+ type: 'string'
747
+ },
748
+ dark: {
749
+ description: ( (localize(
750
+ 'vscode.extension.contributes.submenu.icon.dark',
751
+ 'Icon path when a dark theme is used'
752
+ ))),
753
+ type: 'string'
754
+ }
755
+ }
756
+ }]
757
+ }
758
+ }
759
+ };
760
+ schema.menusContribution = {
761
+ description: ( (localize(
762
+ 'vscode.extension.contributes.menus',
763
+ "Contributes menu items to the editor"
764
+ ))),
765
+ type: 'object',
766
+ properties: index(apiMenus, menu => menu.key, menu => ({
767
+ markdownDescription: menu.proposed ? ( (localize(
768
+ 'proposed',
769
+ "Proposed API, requires `enabledApiProposal: [\"{0}\"]` - {1}",
770
+ menu.proposed,
771
+ menu.description
772
+ ))) : menu.description,
773
+ type: 'array',
774
+ items: menu.supportsSubmenus === false ? menuItem : { oneOf: [menuItem, submenuItem] }
775
+ })),
776
+ additionalProperties: {
777
+ description: 'Submenu',
778
+ type: 'array',
779
+ items: { oneOf: [menuItem, submenuItem] }
780
+ }
781
+ };
782
+ schema.submenusContribution = {
783
+ description: ( (localize(
784
+ 'vscode.extension.contributes.submenus',
785
+ "Contributes submenu items to the editor"
786
+ ))),
787
+ type: 'array',
788
+ items: submenu
789
+ };
790
+ function isValidCommand(command, collector) {
791
+ if (!command) {
792
+ collector.error(( (localize('nonempty', "expected non-empty value."))));
793
+ return false;
794
+ }
795
+ if (isFalsyOrWhitespace(command.command)) {
796
+ collector.error(( (localize(
797
+ 'requirestring',
798
+ "property `{0}` is mandatory and must be of type `string`",
799
+ 'command'
800
+ ))));
801
+ return false;
802
+ }
803
+ if (!isValidLocalizedString(command.title, collector, 'title')) {
804
+ return false;
805
+ }
806
+ if (command.shortTitle && !isValidLocalizedString(command.shortTitle, collector, 'shortTitle')) {
807
+ return false;
808
+ }
809
+ if (command.enablement && typeof command.enablement !== 'string') {
810
+ collector.error(( (localize(
811
+ 'optstring',
812
+ "property `{0}` can be omitted or must be of type `string`",
813
+ 'precondition'
814
+ ))));
815
+ return false;
816
+ }
817
+ if (command.category && !isValidLocalizedString(command.category, collector, 'category')) {
818
+ return false;
819
+ }
820
+ if (!isValidIcon(command.icon, collector)) {
821
+ return false;
822
+ }
823
+ return true;
824
+ }
825
+ schema.isValidCommand = isValidCommand;
826
+ function isValidIcon(icon, collector) {
827
+ if (typeof icon === 'undefined') {
828
+ return true;
829
+ }
830
+ if (typeof icon === 'string') {
831
+ return true;
832
+ }
833
+ else if (typeof icon.dark === 'string' && typeof icon.light === 'string') {
834
+ return true;
835
+ }
836
+ collector.error(( (localize(
837
+ 'opticon',
838
+ "property `icon` can be omitted or must be either a string or a literal like `{dark, light}`"
839
+ ))));
840
+ return false;
841
+ }
842
+ function isValidLocalizedString(localized, collector, propertyName) {
843
+ if (typeof localized === 'undefined') {
844
+ collector.error(( (localize(
845
+ 'requireStringOrObject',
846
+ "property `{0}` is mandatory and must be of type `string` or `object`",
847
+ propertyName
848
+ ))));
849
+ return false;
850
+ }
851
+ else if (typeof localized === 'string' && isFalsyOrWhitespace(localized)) {
852
+ collector.error(( (localize(
853
+ 'requirestring',
854
+ "property `{0}` is mandatory and must be of type `string`",
855
+ propertyName
856
+ ))));
857
+ return false;
858
+ }
859
+ else if (typeof localized !== 'string' && (isFalsyOrWhitespace(localized.original) || isFalsyOrWhitespace(localized.value))) {
860
+ collector.error(( (localize(
861
+ 'requirestrings',
862
+ "properties `{0}` and `{1}` are mandatory and must be of type `string`",
863
+ `${propertyName}.value`,
864
+ `${propertyName}.original`
865
+ ))));
866
+ return false;
867
+ }
868
+ return true;
869
+ }
870
+ const commandType = {
871
+ type: 'object',
872
+ required: ['command', 'title'],
873
+ properties: {
874
+ command: {
875
+ description: ( (localize(
876
+ 'vscode.extension.contributes.commandType.command',
877
+ 'Identifier of the command to execute'
878
+ ))),
879
+ type: 'string'
880
+ },
881
+ title: {
882
+ description: ( (localize(
883
+ 'vscode.extension.contributes.commandType.title',
884
+ 'Title by which the command is represented in the UI'
885
+ ))),
886
+ type: 'string'
887
+ },
888
+ shortTitle: {
889
+ markdownDescription: ( (localize(
890
+ 'vscode.extension.contributes.commandType.shortTitle',
891
+ '(Optional) Short title by which the command is represented in the UI. Menus pick either `title` or `shortTitle` depending on the context in which they show commands.'
892
+ ))),
893
+ type: 'string'
894
+ },
895
+ category: {
896
+ description: ( (localize(
897
+ 'vscode.extension.contributes.commandType.category',
898
+ '(Optional) Category string by which the command is grouped in the UI'
899
+ ))),
900
+ type: 'string'
901
+ },
902
+ enablement: {
903
+ description: ( (localize(
904
+ 'vscode.extension.contributes.commandType.precondition',
905
+ '(Optional) Condition which must be true to enable the command in the UI (menu and keybindings). Does not prevent executing the command by other means, like the `executeCommand`-api.'
906
+ ))),
907
+ type: 'string'
908
+ },
909
+ icon: {
910
+ description: ( (localize(
911
+ { key: 'vscode.extension.contributes.commandType.icon', comment: ['do not translate or change `\\$(zap)`, \\ in front of $ is important.'] },
912
+ '(Optional) Icon which is used to represent the command in the UI. Either a file path, an object with file paths for dark and light themes, or a theme icon references, like `\\$(zap)`'
913
+ ))),
914
+ anyOf: [{
915
+ type: 'string'
916
+ },
917
+ {
918
+ type: 'object',
919
+ properties: {
920
+ light: {
921
+ description: ( (localize(
922
+ 'vscode.extension.contributes.commandType.icon.light',
923
+ 'Icon path when a light theme is used'
924
+ ))),
925
+ type: 'string'
926
+ },
927
+ dark: {
928
+ description: ( (localize(
929
+ 'vscode.extension.contributes.commandType.icon.dark',
930
+ 'Icon path when a dark theme is used'
931
+ ))),
932
+ type: 'string'
933
+ }
934
+ }
935
+ }]
936
+ }
937
+ }
938
+ };
939
+ schema.commandsContribution = {
940
+ description: ( (localize(
941
+ 'vscode.extension.contributes.commands',
942
+ "Contributes commands to the command palette."
943
+ ))),
944
+ oneOf: [
945
+ commandType,
946
+ {
947
+ type: 'array',
948
+ items: commandType
949
+ }
950
+ ]
951
+ };
952
+ })(schema$1 || (schema$1 = {}))));
953
+ const _commandRegistrations = ( (new DisposableStore()));
954
+ const commandsExtensionPoint$1 = ( (ExtensionsRegistry.registerExtensionPoint({
955
+ extensionPoint: 'commands',
956
+ jsonSchema: schema$1.commandsContribution
957
+ })));
958
+ commandsExtensionPoint$1.setHandler(extensions => {
959
+ function handleCommand(userFriendlyCommand, extension, bucket) {
960
+ if (!schema$1.isValidCommand(userFriendlyCommand, extension.collector)) {
961
+ return;
962
+ }
963
+ const { icon, enablement, category, title, shortTitle, command } = userFriendlyCommand;
964
+ let absoluteIcon;
965
+ if (icon) {
966
+ if (typeof icon === 'string') {
967
+ absoluteIcon = ThemeIcon.fromString(icon) ?? { dark: joinPath(extension.description.extensionLocation, icon), light: joinPath(extension.description.extensionLocation, icon) };
968
+ }
969
+ else {
970
+ absoluteIcon = {
971
+ dark: joinPath(extension.description.extensionLocation, icon.dark),
972
+ light: joinPath(extension.description.extensionLocation, icon.light)
973
+ };
974
+ }
975
+ }
976
+ if (MenuRegistry.getCommand(command)) {
977
+ extension.collector.info(( (localize(
978
+ 'dup',
979
+ "Command `{0}` appears multiple times in the `commands` section.",
980
+ userFriendlyCommand.command
981
+ ))));
982
+ }
983
+ bucket.push({
984
+ id: command,
985
+ title,
986
+ source: extension.description.displayName ?? extension.description.name,
987
+ shortTitle,
988
+ tooltip: title,
989
+ category,
990
+ precondition: ContextKeyExpr.deserialize(enablement),
991
+ icon: absoluteIcon
992
+ });
993
+ }
994
+ _commandRegistrations.clear();
995
+ const newCommands = [];
996
+ for (const extension of extensions) {
997
+ const { value } = extension;
998
+ if (Array.isArray(value)) {
999
+ for (const command of value) {
1000
+ handleCommand(command, extension, newCommands);
1001
+ }
1002
+ }
1003
+ else {
1004
+ handleCommand(value, extension, newCommands);
1005
+ }
1006
+ }
1007
+ _commandRegistrations.add(MenuRegistry.addCommands(newCommands));
1008
+ });
1009
+ const _submenus = ( (new Map()));
1010
+ const submenusExtensionPoint = ( (ExtensionsRegistry.registerExtensionPoint({
1011
+ extensionPoint: 'submenus',
1012
+ jsonSchema: schema$1.submenusContribution
1013
+ })));
1014
+ submenusExtensionPoint.setHandler(extensions => {
1015
+ _submenus.clear();
1016
+ for (const extension of extensions) {
1017
+ const { value, collector } = extension;
1018
+ for (const [, submenuInfo] of Object.entries(value)) {
1019
+ if (!schema$1.isValidSubmenu(submenuInfo, collector)) {
1020
+ return;
1021
+ }
1022
+ if (!submenuInfo.id) {
1023
+ collector.warn(( (localize(
1024
+ 'submenuId.invalid.id',
1025
+ "`{0}` is not a valid submenu identifier",
1026
+ submenuInfo.id
1027
+ ))));
1028
+ return;
1029
+ }
1030
+ if (_submenus.has(submenuInfo.id)) {
1031
+ collector.info(( (localize(
1032
+ 'submenuId.duplicate.id',
1033
+ "The `{0}` submenu was already previously registered.",
1034
+ submenuInfo.id
1035
+ ))));
1036
+ return;
1037
+ }
1038
+ if (!submenuInfo.label) {
1039
+ collector.warn(( (localize(
1040
+ 'submenuId.invalid.label',
1041
+ "`{0}` is not a valid submenu label",
1042
+ submenuInfo.label
1043
+ ))));
1044
+ return;
1045
+ }
1046
+ let absoluteIcon;
1047
+ if (submenuInfo.icon) {
1048
+ if (typeof submenuInfo.icon === 'string') {
1049
+ absoluteIcon = ThemeIcon.fromString(submenuInfo.icon) || { dark: joinPath(extension.description.extensionLocation, submenuInfo.icon) };
1050
+ }
1051
+ else {
1052
+ absoluteIcon = {
1053
+ dark: joinPath(extension.description.extensionLocation, submenuInfo.icon.dark),
1054
+ light: joinPath(extension.description.extensionLocation, submenuInfo.icon.light)
1055
+ };
1056
+ }
1057
+ }
1058
+ const item = {
1059
+ id: MenuId.for(`api:${submenuInfo.id}`),
1060
+ label: submenuInfo.label,
1061
+ icon: absoluteIcon
1062
+ };
1063
+ _submenus.set(submenuInfo.id, item);
1064
+ }
1065
+ }
1066
+ });
1067
+ const _apiMenusByKey = ( (new Map(Iterable.map(Iterable.from(apiMenus), menu => ([menu.key, menu])))));
1068
+ const _menuRegistrations = ( (new DisposableStore()));
1069
+ const _submenuMenuItems = ( (new Map()));
1070
+ const menusExtensionPoint = ( (ExtensionsRegistry.registerExtensionPoint({
1071
+ extensionPoint: 'menus',
1072
+ jsonSchema: schema$1.menusContribution,
1073
+ deps: [submenusExtensionPoint]
1074
+ })));
1075
+ menusExtensionPoint.setHandler(extensions => {
1076
+ _menuRegistrations.clear();
1077
+ _submenuMenuItems.clear();
1078
+ const items = [];
1079
+ for (const extension of extensions) {
1080
+ const { value, collector } = extension;
1081
+ for (const entry of Object.entries(value)) {
1082
+ if (!schema$1.isValidItems(entry[1], collector)) {
1083
+ continue;
1084
+ }
1085
+ let menu = _apiMenusByKey.get(entry[0]);
1086
+ if (!menu) {
1087
+ const submenu = _submenus.get(entry[0]);
1088
+ if (submenu) {
1089
+ menu = {
1090
+ key: entry[0],
1091
+ id: submenu.id,
1092
+ description: ''
1093
+ };
1094
+ }
1095
+ }
1096
+ if (!menu) {
1097
+ continue;
1098
+ }
1099
+ if (menu.proposed && !isProposedApiEnabled(extension.description, menu.proposed)) {
1100
+ collector.error(( (localize(
1101
+ 'proposedAPI.invalid',
1102
+ "{0} is a proposed menu identifier. It requires 'package.json#enabledApiProposals: [\"{1}\"]' and is only available when running out of dev or with the following command line switch: --enable-proposed-api {2}",
1103
+ entry[0],
1104
+ menu.proposed,
1105
+ extension.description.identifier.value
1106
+ ))));
1107
+ continue;
1108
+ }
1109
+ for (const menuItem of entry[1]) {
1110
+ let item;
1111
+ if (schema$1.isMenuItem(menuItem)) {
1112
+ const command = MenuRegistry.getCommand(menuItem.command);
1113
+ const alt = menuItem.alt && MenuRegistry.getCommand(menuItem.alt) || undefined;
1114
+ if (!command) {
1115
+ collector.error(( (localize(
1116
+ 'missing.command',
1117
+ "Menu item references a command `{0}` which is not defined in the 'commands' section.",
1118
+ menuItem.command
1119
+ ))));
1120
+ continue;
1121
+ }
1122
+ if (menuItem.alt && !alt) {
1123
+ collector.warn(( (localize(
1124
+ 'missing.altCommand',
1125
+ "Menu item references an alt-command `{0}` which is not defined in the 'commands' section.",
1126
+ menuItem.alt
1127
+ ))));
1128
+ }
1129
+ if (menuItem.command === menuItem.alt) {
1130
+ collector.info(( (localize(
1131
+ 'dupe.command',
1132
+ "Menu item references the same command as default and alt-command"
1133
+ ))));
1134
+ }
1135
+ item = { command, alt, group: undefined, order: undefined, when: undefined };
1136
+ }
1137
+ else {
1138
+ if (menu.supportsSubmenus === false) {
1139
+ collector.error(( (localize(
1140
+ 'unsupported.submenureference',
1141
+ "Menu item references a submenu for a menu which doesn't have submenu support."
1142
+ ))));
1143
+ continue;
1144
+ }
1145
+ const submenu = _submenus.get(menuItem.submenu);
1146
+ if (!submenu) {
1147
+ collector.error(( (localize(
1148
+ 'missing.submenu',
1149
+ "Menu item references a submenu `{0}` which is not defined in the 'submenus' section.",
1150
+ menuItem.submenu
1151
+ ))));
1152
+ continue;
1153
+ }
1154
+ let submenuRegistrations = _submenuMenuItems.get(menu.id.id);
1155
+ if (!submenuRegistrations) {
1156
+ submenuRegistrations = ( (new Set()));
1157
+ _submenuMenuItems.set(menu.id.id, submenuRegistrations);
1158
+ }
1159
+ if (submenuRegistrations.has(submenu.id.id)) {
1160
+ collector.warn(( (localize(
1161
+ 'submenuItem.duplicate',
1162
+ "The `{0}` submenu was already contributed to the `{1}` menu.",
1163
+ menuItem.submenu,
1164
+ entry[0]
1165
+ ))));
1166
+ continue;
1167
+ }
1168
+ submenuRegistrations.add(submenu.id.id);
1169
+ item = { submenu: submenu.id, icon: submenu.icon, title: submenu.label, group: undefined, order: undefined, when: undefined };
1170
+ }
1171
+ if (menuItem.group) {
1172
+ const idx = menuItem.group.lastIndexOf('@');
1173
+ if (idx > 0) {
1174
+ item.group = menuItem.group.substr(0, idx);
1175
+ item.order = Number(menuItem.group.substr(idx + 1)) || undefined;
1176
+ }
1177
+ else {
1178
+ item.group = menuItem.group;
1179
+ }
1180
+ }
1181
+ item.when = ContextKeyExpr.deserialize(menuItem.when);
1182
+ items.push({ id: menu.id, item });
1183
+ }
1184
+ }
1185
+ }
1186
+ _menuRegistrations.add(MenuRegistry.appendMenuItems(items));
1187
+ });
1188
+ function getAllUnboundCommands(boundCommands) {
1189
+ const unboundCommands = [];
1190
+ const seenMap = ( (new Map()));
1191
+ const addCommand = (id, includeCommandWithArgs) => {
1192
+ if (seenMap.has(id)) {
1193
+ return;
1194
+ }
1195
+ seenMap.set(id, true);
1196
+ if (id[0] === '_' || id.indexOf('vscode.') === 0) {
1197
+ return;
1198
+ }
1199
+ if (boundCommands.get(id) === true) {
1200
+ return;
1201
+ }
1202
+ if (!includeCommandWithArgs) {
1203
+ const command = CommandsRegistry.getCommand(id);
1204
+ if (command && typeof command.description === 'object'
1205
+ && isNonEmptyArray(command.description.args)) {
1206
+ return;
1207
+ }
1208
+ }
1209
+ unboundCommands.push(id);
1210
+ };
1211
+ for (const menuItem of MenuRegistry.getMenuItems(MenuId.CommandPalette)) {
1212
+ if (isIMenuItem(menuItem)) {
1213
+ addCommand(menuItem.command.id, true);
1214
+ }
1215
+ }
1216
+ for (const editorAction of EditorExtensionsRegistry.getEditorActions()) {
1217
+ addCommand(editorAction.id, true);
1218
+ }
1219
+ for (const id of ( (CommandsRegistry.getCommands().keys()))) {
1220
+ addCommand(id, false);
1221
+ }
1222
+ return unboundCommands;
1223
+ }
1224
+ class KeybindingParser {
1225
+ static _readModifiers(input) {
1226
+ input = input.toLowerCase().trim();
1227
+ let ctrl = false;
1228
+ let shift = false;
1229
+ let alt = false;
1230
+ let meta = false;
1231
+ let matchedModifier;
1232
+ do {
1233
+ matchedModifier = false;
1234
+ if (/^ctrl(\+|\-)/.test(input)) {
1235
+ ctrl = true;
1236
+ input = input.substr('ctrl-'.length);
1237
+ matchedModifier = true;
1238
+ }
1239
+ if (/^shift(\+|\-)/.test(input)) {
1240
+ shift = true;
1241
+ input = input.substr('shift-'.length);
1242
+ matchedModifier = true;
1243
+ }
1244
+ if (/^alt(\+|\-)/.test(input)) {
1245
+ alt = true;
1246
+ input = input.substr('alt-'.length);
1247
+ matchedModifier = true;
1248
+ }
1249
+ if (/^meta(\+|\-)/.test(input)) {
1250
+ meta = true;
1251
+ input = input.substr('meta-'.length);
1252
+ matchedModifier = true;
1253
+ }
1254
+ if (/^win(\+|\-)/.test(input)) {
1255
+ meta = true;
1256
+ input = input.substr('win-'.length);
1257
+ matchedModifier = true;
1258
+ }
1259
+ if (/^cmd(\+|\-)/.test(input)) {
1260
+ meta = true;
1261
+ input = input.substr('cmd-'.length);
1262
+ matchedModifier = true;
1263
+ }
1264
+ } while (matchedModifier);
1265
+ let key;
1266
+ const firstSpaceIdx = input.indexOf(' ');
1267
+ if (firstSpaceIdx > 0) {
1268
+ key = input.substring(0, firstSpaceIdx);
1269
+ input = input.substring(firstSpaceIdx);
1270
+ }
1271
+ else {
1272
+ key = input;
1273
+ input = '';
1274
+ }
1275
+ return {
1276
+ remains: input,
1277
+ ctrl,
1278
+ shift,
1279
+ alt,
1280
+ meta,
1281
+ key
1282
+ };
1283
+ }
1284
+ static parseSimpleKeybinding(input) {
1285
+ const mods = this._readModifiers(input);
1286
+ const keyCode = KeyCodeUtils.fromUserSettings(mods.key);
1287
+ return [( (new SimpleKeybinding(mods.ctrl, mods.shift, mods.alt, mods.meta, keyCode))), mods.remains];
1288
+ }
1289
+ static parseKeybinding(input, OS) {
1290
+ if (!input) {
1291
+ return null;
1292
+ }
1293
+ const parts = [];
1294
+ let part;
1295
+ do {
1296
+ [part, input] = this.parseSimpleKeybinding(input);
1297
+ parts.push(part);
1298
+ } while (input.length > 0);
1299
+ return (
1300
+ (new ChordKeybinding(parts))
1301
+ );
1302
+ }
1303
+ static parseSimpleUserBinding(input) {
1304
+ const mods = this._readModifiers(input);
1305
+ const scanCodeMatch = mods.key.match(/^\[([^\]]+)\]$/);
1306
+ if (scanCodeMatch) {
1307
+ const strScanCode = scanCodeMatch[1];
1308
+ const scanCode = ScanCodeUtils.lowerCaseToEnum(strScanCode);
1309
+ return [( (new ScanCodeBinding(mods.ctrl, mods.shift, mods.alt, mods.meta, scanCode))), mods.remains];
1310
+ }
1311
+ const keyCode = KeyCodeUtils.fromUserSettings(mods.key);
1312
+ return [( (new SimpleKeybinding(mods.ctrl, mods.shift, mods.alt, mods.meta, keyCode))), mods.remains];
1313
+ }
1314
+ static parseUserBinding(input) {
1315
+ if (!input) {
1316
+ return [];
1317
+ }
1318
+ const parts = [];
1319
+ let part;
1320
+ while (input.length > 0) {
1321
+ [part, input] = this.parseSimpleUserBinding(input);
1322
+ parts.push(part);
1323
+ }
1324
+ return parts;
1325
+ }
1326
+ }
1327
+ class KeybindingIO {
1328
+ static writeKeybindingItem(out, item) {
1329
+ if (!item.resolvedKeybinding) {
1330
+ return;
1331
+ }
1332
+ const quotedSerializedKeybinding = JSON.stringify(item.resolvedKeybinding.getUserSettingsLabel());
1333
+ out.write(`{ "key": ${rightPaddedString(quotedSerializedKeybinding + ',', 25)} "command": `);
1334
+ const quotedSerializedWhen = item.when ? JSON.stringify(item.when.serialize()) : '';
1335
+ const quotedSerializeCommand = JSON.stringify(item.command);
1336
+ if (quotedSerializedWhen.length > 0) {
1337
+ out.write(`${quotedSerializeCommand},`);
1338
+ out.writeLine();
1339
+ out.write(` "when": ${quotedSerializedWhen}`);
1340
+ }
1341
+ else {
1342
+ out.write(`${quotedSerializeCommand}`);
1343
+ }
1344
+ if (item.commandArgs) {
1345
+ out.write(',');
1346
+ out.writeLine();
1347
+ out.write(` "args": ${JSON.stringify(item.commandArgs)}`);
1348
+ }
1349
+ out.write(' }');
1350
+ }
1351
+ static readUserKeybindingItem(input) {
1352
+ const parts = (typeof input.key === 'string' ? KeybindingParser.parseUserBinding(input.key) : []);
1353
+ const when = (typeof input.when === 'string' ? ContextKeyExpr.deserialize(input.when) : undefined);
1354
+ const command = (typeof input.command === 'string' ? input.command : null);
1355
+ const commandArgs = (typeof input.args !== 'undefined' ? input.args : undefined);
1356
+ return {
1357
+ parts: parts,
1358
+ command: command,
1359
+ commandArgs: commandArgs,
1360
+ when: when
1361
+ };
1362
+ }
1363
+ }
1364
+ function rightPaddedString(str, minChars) {
1365
+ if (str.length < minChars) {
1366
+ return str + (( (new Array(minChars - str.length))).join(' '));
1367
+ }
1368
+ return str;
1369
+ }
1370
+ class OutputBuilder {
1371
+ constructor() {
1372
+ this._lines = [];
1373
+ this._currentLine = '';
1374
+ }
1375
+ write(str) {
1376
+ this._currentLine += str;
1377
+ }
1378
+ writeLine(str = '') {
1379
+ this._lines.push(this._currentLine + str);
1380
+ this._currentLine = '';
1381
+ }
1382
+ toString() {
1383
+ this.writeLine();
1384
+ return this._lines.join('\n');
1385
+ }
1386
+ }
1387
+ function getDispatchConfig(configurationService) {
1388
+ const keyboard = configurationService.getValue('keyboard');
1389
+ const r = (keyboard ? keyboard.dispatch : null);
1390
+ return (r === 'keyCode' ? 1 : 0) ;
1391
+ }
1392
+ function isContributedKeyBindingsArray(thing) {
1393
+ return Array.isArray(thing);
1394
+ }
1395
+ function isValidContributedKeyBinding(keyBinding, rejects) {
1396
+ if (!keyBinding) {
1397
+ rejects.push(( (localize('nonempty', "expected non-empty value."))));
1398
+ return false;
1399
+ }
1400
+ if (typeof keyBinding.command !== 'string') {
1401
+ rejects.push(( (localize(
1402
+ 'requirestring',
1403
+ "property `{0}` is mandatory and must be of type `string`",
1404
+ 'command'
1405
+ ))));
1406
+ return false;
1407
+ }
1408
+ if (keyBinding.key && typeof keyBinding.key !== 'string') {
1409
+ rejects.push(( (localize(
1410
+ 'optstring',
1411
+ "property `{0}` can be omitted or must be of type `string`",
1412
+ 'key'
1413
+ ))));
1414
+ return false;
1415
+ }
1416
+ if (keyBinding.when && typeof keyBinding.when !== 'string') {
1417
+ rejects.push(( (localize(
1418
+ 'optstring',
1419
+ "property `{0}` can be omitted or must be of type `string`",
1420
+ 'when'
1421
+ ))));
1422
+ return false;
1423
+ }
1424
+ if (keyBinding.mac && typeof keyBinding.mac !== 'string') {
1425
+ rejects.push(( (localize(
1426
+ 'optstring',
1427
+ "property `{0}` can be omitted or must be of type `string`",
1428
+ 'mac'
1429
+ ))));
1430
+ return false;
1431
+ }
1432
+ if (keyBinding.linux && typeof keyBinding.linux !== 'string') {
1433
+ rejects.push(( (localize(
1434
+ 'optstring',
1435
+ "property `{0}` can be omitted or must be of type `string`",
1436
+ 'linux'
1437
+ ))));
1438
+ return false;
1439
+ }
1440
+ if (keyBinding.win && typeof keyBinding.win !== 'string') {
1441
+ rejects.push(( (localize(
1442
+ 'optstring',
1443
+ "property `{0}` can be omitted or must be of type `string`",
1444
+ 'win'
1445
+ ))));
1446
+ return false;
1447
+ }
1448
+ return true;
1449
+ }
1450
+ const keybindingType = {
1451
+ type: 'object',
1452
+ default: { command: '', key: '' },
1453
+ properties: {
1454
+ command: {
1455
+ description: ( (localize(
1456
+ 'vscode.extension.contributes.keybindings.command',
1457
+ 'Identifier of the command to run when keybinding is triggered.'
1458
+ ))),
1459
+ type: 'string'
1460
+ },
1461
+ args: {
1462
+ description: ( (localize(
1463
+ 'vscode.extension.contributes.keybindings.args',
1464
+ "Arguments to pass to the command to execute."
1465
+ )))
1466
+ },
1467
+ key: {
1468
+ description: ( (localize(
1469
+ 'vscode.extension.contributes.keybindings.key',
1470
+ 'Key or key sequence (separate keys with plus-sign and sequences with space, e.g. Ctrl+O and Ctrl+L L for a chord).'
1471
+ ))),
1472
+ type: 'string'
1473
+ },
1474
+ mac: {
1475
+ description: ( (localize(
1476
+ 'vscode.extension.contributes.keybindings.mac',
1477
+ 'Mac specific key or key sequence.'
1478
+ ))),
1479
+ type: 'string'
1480
+ },
1481
+ linux: {
1482
+ description: ( (localize(
1483
+ 'vscode.extension.contributes.keybindings.linux',
1484
+ 'Linux specific key or key sequence.'
1485
+ ))),
1486
+ type: 'string'
1487
+ },
1488
+ win: {
1489
+ description: ( (localize(
1490
+ 'vscode.extension.contributes.keybindings.win',
1491
+ 'Windows specific key or key sequence.'
1492
+ ))),
1493
+ type: 'string'
1494
+ },
1495
+ when: {
1496
+ description: ( (localize(
1497
+ 'vscode.extension.contributes.keybindings.when',
1498
+ 'Condition when the key is active.'
1499
+ ))),
1500
+ type: 'string'
1501
+ },
1502
+ }
1503
+ };
1504
+ const keybindingsExtPoint = ( (ExtensionsRegistry.registerExtensionPoint({
1505
+ extensionPoint: 'keybindings',
1506
+ deps: [commandsExtensionPoint$1],
1507
+ jsonSchema: {
1508
+ description: ( (localize('vscode.extension.contributes.keybindings', "Contributes keybindings."))),
1509
+ oneOf: [
1510
+ keybindingType,
1511
+ {
1512
+ type: 'array',
1513
+ items: keybindingType
1514
+ }
1515
+ ]
1516
+ }
1517
+ })));
1518
+ const NUMPAD_PRINTABLE_SCANCODES = [
1519
+ 90 ,
1520
+ 91 ,
1521
+ 92 ,
1522
+ 93 ,
1523
+ 95 ,
1524
+ 96 ,
1525
+ 97 ,
1526
+ 98 ,
1527
+ 99 ,
1528
+ 100 ,
1529
+ 101 ,
1530
+ 102 ,
1531
+ 103 ,
1532
+ 104 ,
1533
+ 105
1534
+ ];
1535
+ const otherMacNumpadMapping = ( (new Map()));
1536
+ otherMacNumpadMapping.set(95 , 22 );
1537
+ otherMacNumpadMapping.set(96 , 23 );
1538
+ otherMacNumpadMapping.set(97 , 24 );
1539
+ otherMacNumpadMapping.set(98 , 25 );
1540
+ otherMacNumpadMapping.set(99 , 26 );
1541
+ otherMacNumpadMapping.set(100 , 27 );
1542
+ otherMacNumpadMapping.set(101 , 28 );
1543
+ otherMacNumpadMapping.set(102 , 29 );
1544
+ otherMacNumpadMapping.set(103 , 30 );
1545
+ otherMacNumpadMapping.set(104 , 21 );
1546
+ let WorkbenchKeybindingService = class WorkbenchKeybindingService extends AbstractKeybindingService {
1547
+ constructor(contextKeyService, commandService, telemetryService, notificationService, userDataProfileService, configurationService, hostService, extensionService, fileService, logService, keyboardLayoutService) {
1548
+ super(contextKeyService, commandService, telemetryService, notificationService, logService);
1549
+ this.hostService = hostService;
1550
+ this.keyboardLayoutService = keyboardLayoutService;
1551
+ this._contributions = [];
1552
+ this.isComposingGlobalContextKey = contextKeyService.createKey('isComposing', false);
1553
+ this.updateSchema();
1554
+ let dispatchConfig = getDispatchConfig(configurationService);
1555
+ configurationService.onDidChangeConfiguration((e) => {
1556
+ const newDispatchConfig = getDispatchConfig(configurationService);
1557
+ if (dispatchConfig === newDispatchConfig) {
1558
+ return;
1559
+ }
1560
+ dispatchConfig = newDispatchConfig;
1561
+ this._keyboardMapper = this.keyboardLayoutService.getKeyboardMapper(dispatchConfig);
1562
+ this.updateResolver();
1563
+ });
1564
+ this._keyboardMapper = this.keyboardLayoutService.getKeyboardMapper(dispatchConfig);
1565
+ this.keyboardLayoutService.onDidChangeKeyboardLayout(() => {
1566
+ this._keyboardMapper = this.keyboardLayoutService.getKeyboardMapper(dispatchConfig);
1567
+ this.updateResolver();
1568
+ });
1569
+ this._cachedResolver = null;
1570
+ this.userKeybindings = this._register(( (new UserKeybindings(userDataProfileService, fileService, logService))));
1571
+ this.userKeybindings.initialize().then(() => {
1572
+ if (this.userKeybindings.keybindings.length) {
1573
+ this.updateResolver();
1574
+ }
1575
+ });
1576
+ this._register(this.userKeybindings.onDidChange(() => {
1577
+ logService.debug('User keybindings changed');
1578
+ this.updateResolver();
1579
+ }));
1580
+ keybindingsExtPoint.setHandler((extensions) => {
1581
+ const keybindings = [];
1582
+ for (const extension of extensions) {
1583
+ this._handleKeybindingsExtensionPointUser(extension.description.identifier, extension.description.isBuiltin, extension.value, extension.collector, keybindings);
1584
+ }
1585
+ KeybindingsRegistry.setExtensionKeybindings(keybindings);
1586
+ this.updateResolver();
1587
+ });
1588
+ this.updateSchema();
1589
+ this._register(extensionService.onDidRegisterExtensions(() => this.updateSchema()));
1590
+ this._register(addDisposableListener(window, EventType.KEY_DOWN, (e) => {
1591
+ this.isComposingGlobalContextKey.set(e.isComposing);
1592
+ const keyEvent = ( (new StandardKeyboardEvent(e)));
1593
+ this._log(`/ Received keydown event - ${printKeyboardEvent(e)}`);
1594
+ this._log(`| Converted keydown event - ${printStandardKeyboardEvent(keyEvent)}`);
1595
+ const shouldPreventDefault = this._dispatch(keyEvent, keyEvent.target);
1596
+ if (shouldPreventDefault) {
1597
+ keyEvent.preventDefault();
1598
+ }
1599
+ this.isComposingGlobalContextKey.set(false);
1600
+ }));
1601
+ this._register(addDisposableListener(window, EventType.KEY_UP, (e) => {
1602
+ this.isComposingGlobalContextKey.set(e.isComposing);
1603
+ const keyEvent = ( (new StandardKeyboardEvent(e)));
1604
+ const shouldPreventDefault = this._singleModifierDispatch(keyEvent, keyEvent.target);
1605
+ if (shouldPreventDefault) {
1606
+ keyEvent.preventDefault();
1607
+ }
1608
+ this.isComposingGlobalContextKey.set(false);
1609
+ }));
1610
+ this._register(onDidChangeFullscreen(() => {
1611
+ const keyboard = navigator.keyboard;
1612
+ if (BrowserFeatures.keyboard === 2 ) {
1613
+ return;
1614
+ }
1615
+ if (isFullscreen()) {
1616
+ keyboard?.lock(['Escape']);
1617
+ }
1618
+ else {
1619
+ keyboard?.unlock();
1620
+ }
1621
+ this._cachedResolver = null;
1622
+ this._onDidUpdateKeybindings.fire();
1623
+ }));
1624
+ }
1625
+ registerSchemaContribution(contribution) {
1626
+ this._contributions.push(contribution);
1627
+ if (contribution.onDidChange) {
1628
+ this._register(contribution.onDidChange(() => this.updateSchema()));
1629
+ }
1630
+ this.updateSchema();
1631
+ }
1632
+ updateSchema() {
1633
+ updateSchema(flatten(this._contributions.map(x => x.getSchemaAdditions())));
1634
+ }
1635
+ _printUserBinding(parts) {
1636
+ return UserSettingsLabelProvider.toLabel(OS, parts, (part) => {
1637
+ if (part instanceof SimpleKeybinding) {
1638
+ return (
1639
+ (KeyCodeUtils.toString(part.keyCode))
1640
+ );
1641
+ }
1642
+ return (
1643
+ (ScanCodeUtils.toString(part.scanCode))
1644
+ );
1645
+ }) || '[null]';
1646
+ }
1647
+ _printResolvedKeybinding(resolvedKeybinding) {
1648
+ return resolvedKeybinding.getDispatchParts().map(x => x || '[null]').join(' ');
1649
+ }
1650
+ _printResolvedKeybindings(output, input, resolvedKeybindings) {
1651
+ const padLength = 35;
1652
+ const firstRow = `${input.padStart(padLength, ' ')} => `;
1653
+ if (resolvedKeybindings.length === 0) {
1654
+ output.push(`${firstRow}${'[NO BINDING]'.padStart(padLength, ' ')}`);
1655
+ return;
1656
+ }
1657
+ for (const resolvedKeybinding of resolvedKeybindings) {
1658
+ {
1659
+ output.push(`${firstRow}${this._printResolvedKeybinding(resolvedKeybinding).padStart(padLength, ' ')}`);
1660
+ }
1661
+ }
1662
+ }
1663
+ _dumpResolveKeybindingDebugInfo() {
1664
+ const seenBindings = ( (new Set()));
1665
+ const result = [];
1666
+ result.push(`Default Resolved Keybindings (unique only):`);
1667
+ for (const item of KeybindingsRegistry.getDefaultKeybindings()) {
1668
+ if (!item.keybinding || item.keybinding.length === 0) {
1669
+ continue;
1670
+ }
1671
+ const input = this._printUserBinding(item.keybinding);
1672
+ if (seenBindings.has(input)) {
1673
+ continue;
1674
+ }
1675
+ seenBindings.add(input);
1676
+ const resolvedKeybindings = this._keyboardMapper.resolveUserBinding(item.keybinding);
1677
+ this._printResolvedKeybindings(result, input, resolvedKeybindings);
1678
+ }
1679
+ result.push(`User Resolved Keybindings (unique only):`);
1680
+ for (const _item of this.userKeybindings.keybindings) {
1681
+ const item = KeybindingIO.readUserKeybindingItem(_item);
1682
+ if (!item.parts || item.parts.length === 0) {
1683
+ continue;
1684
+ }
1685
+ const input = _item.key;
1686
+ if (seenBindings.has(input)) {
1687
+ continue;
1688
+ }
1689
+ seenBindings.add(input);
1690
+ const resolvedKeybindings = this._keyboardMapper.resolveUserBinding(item.parts);
1691
+ this._printResolvedKeybindings(result, input, resolvedKeybindings);
1692
+ }
1693
+ return result.join('\n');
1694
+ }
1695
+ _dumpDebugInfo() {
1696
+ const layoutInfo = JSON.stringify(this.keyboardLayoutService.getCurrentKeyboardLayout(), null, '\t');
1697
+ const mapperInfo = this._keyboardMapper.dumpDebugInfo();
1698
+ const resolvedKeybindings = this._dumpResolveKeybindingDebugInfo();
1699
+ const rawMapping = JSON.stringify(this.keyboardLayoutService.getRawKeyboardMapping(), null, '\t');
1700
+ return `Layout info:\n${layoutInfo}\n\n${resolvedKeybindings}\n\n${mapperInfo}\n\nRaw mapping:\n${rawMapping}`;
1701
+ }
1702
+ _dumpDebugInfoJSON() {
1703
+ const info = {
1704
+ layout: this.keyboardLayoutService.getCurrentKeyboardLayout(),
1705
+ rawMapping: this.keyboardLayoutService.getRawKeyboardMapping()
1706
+ };
1707
+ return JSON.stringify(info, null, '\t');
1708
+ }
1709
+ customKeybindingsCount() {
1710
+ return this.userKeybindings.keybindings.length;
1711
+ }
1712
+ updateResolver() {
1713
+ this._cachedResolver = null;
1714
+ this._onDidUpdateKeybindings.fire();
1715
+ }
1716
+ _getResolver() {
1717
+ if (!this._cachedResolver) {
1718
+ const defaults = this._resolveKeybindingItems(KeybindingsRegistry.getDefaultKeybindings(), true);
1719
+ const overrides = this._resolveUserKeybindingItems(this.userKeybindings.keybindings.map((k) => KeybindingIO.readUserKeybindingItem(k)), false);
1720
+ this._cachedResolver = ( (new KeybindingResolver(defaults, overrides, (str) => this._log(str))));
1721
+ }
1722
+ return this._cachedResolver;
1723
+ }
1724
+ _documentHasFocus() {
1725
+ return this.hostService.hasFocus;
1726
+ }
1727
+ _resolveKeybindingItems(items, isDefault) {
1728
+ const result = [];
1729
+ let resultLen = 0;
1730
+ for (const item of items) {
1731
+ const when = item.when || undefined;
1732
+ const keybinding = item.keybinding;
1733
+ if (!keybinding) {
1734
+ result[resultLen++] = ( (new ResolvedKeybindingItem(
1735
+ undefined,
1736
+ item.command,
1737
+ item.commandArgs,
1738
+ when,
1739
+ isDefault,
1740
+ item.extensionId,
1741
+ item.isBuiltinExtension
1742
+ )));
1743
+ }
1744
+ else {
1745
+ if (this._assertBrowserConflicts(keybinding, item.command)) {
1746
+ continue;
1747
+ }
1748
+ const resolvedKeybindings = this._keyboardMapper.resolveUserBinding(keybinding);
1749
+ for (let i = resolvedKeybindings.length - 1; i >= 0; i--) {
1750
+ const resolvedKeybinding = resolvedKeybindings[i];
1751
+ result[resultLen++] = ( (new ResolvedKeybindingItem(
1752
+ resolvedKeybinding,
1753
+ item.command,
1754
+ item.commandArgs,
1755
+ when,
1756
+ isDefault,
1757
+ item.extensionId,
1758
+ item.isBuiltinExtension
1759
+ )));
1760
+ }
1761
+ }
1762
+ }
1763
+ return result;
1764
+ }
1765
+ _resolveUserKeybindingItems(items, isDefault) {
1766
+ const result = [];
1767
+ let resultLen = 0;
1768
+ for (const item of items) {
1769
+ const when = item.when || undefined;
1770
+ const parts = item.parts;
1771
+ if (parts.length === 0) {
1772
+ result[resultLen++] = ( (new ResolvedKeybindingItem(undefined, item.command, item.commandArgs, when, isDefault, null, false)));
1773
+ }
1774
+ else {
1775
+ const resolvedKeybindings = this._keyboardMapper.resolveUserBinding(parts);
1776
+ for (const resolvedKeybinding of resolvedKeybindings) {
1777
+ result[resultLen++] = ( (new ResolvedKeybindingItem(
1778
+ resolvedKeybinding,
1779
+ item.command,
1780
+ item.commandArgs,
1781
+ when,
1782
+ isDefault,
1783
+ null,
1784
+ false
1785
+ )));
1786
+ }
1787
+ }
1788
+ }
1789
+ return result;
1790
+ }
1791
+ _assertBrowserConflicts(kb, commandId) {
1792
+ if (BrowserFeatures.keyboard === 0 ) {
1793
+ return false;
1794
+ }
1795
+ if (BrowserFeatures.keyboard === 1 && isFullscreen()) {
1796
+ return false;
1797
+ }
1798
+ for (const part of kb) {
1799
+ if (!part.metaKey && !part.altKey && !part.ctrlKey && !part.shiftKey) {
1800
+ continue;
1801
+ }
1802
+ const modifiersMask = 2048 | 512 | 1024 ;
1803
+ let partModifiersMask = 0;
1804
+ if (part.metaKey) {
1805
+ partModifiersMask |= 2048 ;
1806
+ }
1807
+ if (part.shiftKey) {
1808
+ partModifiersMask |= 1024 ;
1809
+ }
1810
+ if (part.altKey) {
1811
+ partModifiersMask |= 512 ;
1812
+ }
1813
+ if (part.ctrlKey && OS === 2 ) {
1814
+ partModifiersMask |= 256 ;
1815
+ }
1816
+ if ((partModifiersMask & modifiersMask) === ((2048 | 512) )) {
1817
+ if (part instanceof ScanCodeBinding && ((part.scanCode === 86 || part.scanCode === 85) )) {
1818
+ return true;
1819
+ }
1820
+ if (part instanceof SimpleKeybinding && ((part.keyCode === 15 || part.keyCode === 17) )) {
1821
+ return true;
1822
+ }
1823
+ }
1824
+ if ((partModifiersMask & modifiersMask) === 2048 ) {
1825
+ if (part instanceof ScanCodeBinding && ((part.scanCode >= 36 && part.scanCode <= 45) )) {
1826
+ return true;
1827
+ }
1828
+ if (part instanceof SimpleKeybinding && ((part.keyCode >= 21 && part.keyCode <= 30) )) {
1829
+ return true;
1830
+ }
1831
+ }
1832
+ }
1833
+ return false;
1834
+ }
1835
+ resolveKeybinding(kb) {
1836
+ return this._keyboardMapper.resolveKeybinding(kb);
1837
+ }
1838
+ resolveKeyboardEvent(keyboardEvent) {
1839
+ this.keyboardLayoutService.validateCurrentKeyboardMapping(keyboardEvent);
1840
+ return this._keyboardMapper.resolveKeyboardEvent(keyboardEvent);
1841
+ }
1842
+ resolveUserBinding(userBinding) {
1843
+ const parts = KeybindingParser.parseUserBinding(userBinding);
1844
+ return this._keyboardMapper.resolveUserBinding(parts);
1845
+ }
1846
+ _handleKeybindingsExtensionPointUser(extensionId, isBuiltin, keybindings, collector, result) {
1847
+ if (isContributedKeyBindingsArray(keybindings)) {
1848
+ for (let i = 0, len = keybindings.length; i < len; i++) {
1849
+ this._handleKeybinding(extensionId, isBuiltin, i + 1, keybindings[i], collector, result);
1850
+ }
1851
+ }
1852
+ else {
1853
+ this._handleKeybinding(extensionId, isBuiltin, 1, keybindings, collector, result);
1854
+ }
1855
+ }
1856
+ _handleKeybinding(extensionId, isBuiltin, idx, keybindings, collector, result) {
1857
+ const rejects = [];
1858
+ if (isValidContributedKeyBinding(keybindings, rejects)) {
1859
+ const rule = this._asCommandRule(extensionId, isBuiltin, idx++, keybindings);
1860
+ if (rule) {
1861
+ result.push(rule);
1862
+ }
1863
+ }
1864
+ if (rejects.length > 0) {
1865
+ collector.error(( (localize(
1866
+ 'invalid.keybindings',
1867
+ "Invalid `contributes.{0}`: {1}",
1868
+ keybindingsExtPoint.name,
1869
+ rejects.join('\n')
1870
+ ))));
1871
+ }
1872
+ }
1873
+ static bindToCurrentPlatform(key, mac, linux, win) {
1874
+ if (OS === 1 && win) {
1875
+ if (win) {
1876
+ return win;
1877
+ }
1878
+ }
1879
+ else if (OS === 2 ) {
1880
+ if (mac) {
1881
+ return mac;
1882
+ }
1883
+ }
1884
+ else {
1885
+ if (linux) {
1886
+ return linux;
1887
+ }
1888
+ }
1889
+ return key;
1890
+ }
1891
+ _asCommandRule(extensionId, isBuiltin, idx, binding) {
1892
+ const { command, args, when, key, mac, linux, win } = binding;
1893
+ const keybinding = WorkbenchKeybindingService.bindToCurrentPlatform(key, mac, linux, win);
1894
+ if (!keybinding) {
1895
+ return undefined;
1896
+ }
1897
+ let weight;
1898
+ if (isBuiltin) {
1899
+ weight = 300 + idx;
1900
+ }
1901
+ else {
1902
+ weight = 400 + idx;
1903
+ }
1904
+ const commandAction = MenuRegistry.getCommand(command);
1905
+ const precondition = commandAction && commandAction.precondition;
1906
+ let fullWhen;
1907
+ if (when && precondition) {
1908
+ fullWhen = ContextKeyExpr.and(precondition, ContextKeyExpr.deserialize(when));
1909
+ }
1910
+ else if (when) {
1911
+ fullWhen = ContextKeyExpr.deserialize(when);
1912
+ }
1913
+ else if (precondition) {
1914
+ fullWhen = precondition;
1915
+ }
1916
+ const desc = {
1917
+ id: command,
1918
+ args,
1919
+ when: fullWhen,
1920
+ weight: weight,
1921
+ keybinding: KeybindingParser.parseUserBinding(keybinding),
1922
+ extensionId: extensionId.value,
1923
+ isBuiltinExtension: isBuiltin
1924
+ };
1925
+ return desc;
1926
+ }
1927
+ getDefaultKeybindingsContent() {
1928
+ const resolver = this._getResolver();
1929
+ const defaultKeybindings = resolver.getDefaultKeybindings();
1930
+ const boundCommands = resolver.getDefaultBoundCommands();
1931
+ return (WorkbenchKeybindingService._getDefaultKeybindings(defaultKeybindings)
1932
+ + '\n\n'
1933
+ + WorkbenchKeybindingService._getAllCommandsAsComment(boundCommands));
1934
+ }
1935
+ static _getDefaultKeybindings(defaultKeybindings) {
1936
+ const out = ( (new OutputBuilder()));
1937
+ out.writeLine('[');
1938
+ const lastIndex = defaultKeybindings.length - 1;
1939
+ defaultKeybindings.forEach((k, index) => {
1940
+ KeybindingIO.writeKeybindingItem(out, k);
1941
+ if (index !== lastIndex) {
1942
+ out.writeLine(',');
1943
+ }
1944
+ else {
1945
+ out.writeLine();
1946
+ }
1947
+ });
1948
+ out.writeLine(']');
1949
+ return (
1950
+ (out.toString())
1951
+ );
1952
+ }
1953
+ static _getAllCommandsAsComment(boundCommands) {
1954
+ const unboundCommands = getAllUnboundCommands(boundCommands);
1955
+ const pretty = unboundCommands.sort().join('\n// - ');
1956
+ return '// ' + ( (localize('unboundCommands', "Here are other available commands: "))) + '\n// - ' + pretty;
1957
+ }
1958
+ mightProducePrintableCharacter(event) {
1959
+ if (event.ctrlKey || event.metaKey || event.altKey) {
1960
+ return false;
1961
+ }
1962
+ const code = ScanCodeUtils.toEnum(event.code);
1963
+ if (NUMPAD_PRINTABLE_SCANCODES.indexOf(code) !== -1) {
1964
+ if (event.keyCode === IMMUTABLE_CODE_TO_KEY_CODE[code]) {
1965
+ return true;
1966
+ }
1967
+ if (isMacintosh && event.keyCode === otherMacNumpadMapping.get(code)) {
1968
+ return true;
1969
+ }
1970
+ return false;
1971
+ }
1972
+ const keycode = IMMUTABLE_CODE_TO_KEY_CODE[code];
1973
+ if (keycode !== -1) {
1974
+ return false;
1975
+ }
1976
+ const mapping = this.keyboardLayoutService.getRawKeyboardMapping();
1977
+ if (!mapping) {
1978
+ return false;
1979
+ }
1980
+ const keyInfo = mapping[event.code];
1981
+ if (!keyInfo) {
1982
+ return false;
1983
+ }
1984
+ if (!keyInfo.value || /\s/.test(keyInfo.value)) {
1985
+ return false;
1986
+ }
1987
+ return true;
1988
+ }
1989
+ };
1990
+ WorkbenchKeybindingService = ( (__decorate([
1991
+ ( (__param(0, IContextKeyService))),
1992
+ ( (__param(1, ICommandService))),
1993
+ ( (__param(2, ITelemetryService))),
1994
+ ( (__param(3, INotificationService))),
1995
+ ( (__param(4, IUserDataProfileService))),
1996
+ ( (__param(5, IConfigurationService))),
1997
+ ( (__param(6, IHostService))),
1998
+ ( (__param(7, IExtensionService))),
1999
+ ( (__param(8, IFileService))),
2000
+ ( (__param(9, ILogService))),
2001
+ ( (__param(10, IKeyboardLayoutService)))
2002
+ ], WorkbenchKeybindingService)));
2003
+ class UserKeybindings extends Disposable {
2004
+ constructor(userDataProfileService, fileService, logService) {
2005
+ super();
2006
+ this.userDataProfileService = userDataProfileService;
2007
+ this.fileService = fileService;
2008
+ this._keybindings = [];
2009
+ this.watchDisposables = this._register(( (new DisposableStore())));
2010
+ this._onDidChange = this._register(( (new Emitter())));
2011
+ this.onDidChange = this._onDidChange.event;
2012
+ this.watch();
2013
+ this.reloadConfigurationScheduler = this._register(( (new RunOnceScheduler(() => this.reload().then(changed => {
2014
+ if (changed) {
2015
+ this._onDidChange.fire();
2016
+ }
2017
+ }), 50))));
2018
+ this._register(Event.filter(this.fileService.onDidFilesChange, e => e.contains(this.userDataProfileService.currentProfile.keybindingsResource))(() => {
2019
+ logService.debug('Keybindings file changed');
2020
+ this.reloadConfigurationScheduler.schedule();
2021
+ }));
2022
+ this._register(this.fileService.onDidRunOperation((e) => {
2023
+ if (e.operation === 4 && ( (e.resource.toString())) === ( (this.userDataProfileService.currentProfile.keybindingsResource.toString()))) {
2024
+ logService.debug('Keybindings file written');
2025
+ this.reloadConfigurationScheduler.schedule();
2026
+ }
2027
+ }));
2028
+ this._register(userDataProfileService.onDidChangeCurrentProfile(e => e.join(this.whenCurrentProfieChanged(e))));
2029
+ }
2030
+ get keybindings() { return this._keybindings; }
2031
+ async whenCurrentProfieChanged(e) {
2032
+ if (e.preserveData) {
2033
+ if (await this.fileService.exists(e.previous.keybindingsResource)) {
2034
+ await this.fileService.copy(e.previous.keybindingsResource, e.profile.keybindingsResource);
2035
+ }
2036
+ }
2037
+ this.watch();
2038
+ this.reloadConfigurationScheduler.schedule();
2039
+ }
2040
+ watch() {
2041
+ this.watchDisposables.clear();
2042
+ this.watchDisposables.add(this.fileService.watch(dirname(this.userDataProfileService.currentProfile.keybindingsResource)));
2043
+ this.watchDisposables.add(this.fileService.watch(this.userDataProfileService.currentProfile.keybindingsResource));
2044
+ }
2045
+ async initialize() {
2046
+ await this.reload();
2047
+ }
2048
+ async reload() {
2049
+ const existing = this._keybindings;
2050
+ try {
2051
+ const content = await this.fileService.readFile(this.userDataProfileService.currentProfile.keybindingsResource);
2052
+ const value = parse(( (content.value.toString())));
2053
+ this._keybindings = isArray(value) ? value : [];
2054
+ }
2055
+ catch (e) {
2056
+ this._keybindings = [];
2057
+ }
2058
+ return existing ? !equals(existing, this._keybindings) : true;
2059
+ }
2060
+ }
2061
+ const schemaId = 'vscode://schemas/keybindings';
2062
+ const commandsSchemas = [];
2063
+ const commandsEnum = [];
2064
+ const commandsEnumDescriptions = [];
2065
+ const schema = {
2066
+ id: schemaId,
2067
+ type: 'array',
2068
+ title: ( (localize('keybindings.json.title', "Keybindings configuration"))),
2069
+ allowTrailingCommas: true,
2070
+ allowComments: true,
2071
+ definitions: {
2072
+ 'editorGroupsSchema': {
2073
+ 'type': 'array',
2074
+ 'items': {
2075
+ 'type': 'object',
2076
+ 'properties': {
2077
+ 'groups': {
2078
+ '$ref': '#/definitions/editorGroupsSchema',
2079
+ 'default': [{}, {}]
2080
+ },
2081
+ 'size': {
2082
+ 'type': 'number',
2083
+ 'default': 0.5
2084
+ }
2085
+ }
2086
+ }
2087
+ }
2088
+ },
2089
+ items: {
2090
+ 'required': ['key'],
2091
+ 'type': 'object',
2092
+ 'defaultSnippets': [{ 'body': { 'key': '$1', 'command': '$2', 'when': '$3' } }],
2093
+ 'properties': {
2094
+ 'key': {
2095
+ 'type': 'string',
2096
+ 'description': ( (localize('keybindings.json.key', "Key or key sequence (separated by space)"))),
2097
+ },
2098
+ 'command': {
2099
+ 'anyOf': [
2100
+ {
2101
+ 'type': 'string',
2102
+ 'enum': commandsEnum,
2103
+ 'enumDescriptions': commandsEnumDescriptions,
2104
+ 'description': ( (localize('keybindings.json.command', "Name of the command to execute"))),
2105
+ },
2106
+ {
2107
+ 'type': 'string'
2108
+ }
2109
+ ]
2110
+ },
2111
+ 'when': {
2112
+ 'type': 'string',
2113
+ 'description': ( (localize('keybindings.json.when', "Condition when the key is active.")))
2114
+ },
2115
+ 'args': {
2116
+ 'description': ( (localize('keybindings.json.args', "Arguments to pass to the command to execute.")))
2117
+ }
2118
+ },
2119
+ 'allOf': commandsSchemas
2120
+ }
2121
+ };
2122
+ const schemaRegistry = ( (Registry.as(Extensions.JSONContribution)));
2123
+ schemaRegistry.registerSchema(schemaId, schema);
2124
+ function updateSchema(additionalContributions) {
2125
+ commandsSchemas.length = 0;
2126
+ commandsEnum.length = 0;
2127
+ commandsEnumDescriptions.length = 0;
2128
+ const knownCommands = ( (new Set()));
2129
+ const addKnownCommand = (commandId, description) => {
2130
+ if (!/^_/.test(commandId)) {
2131
+ if (!knownCommands.has(commandId)) {
2132
+ knownCommands.add(commandId);
2133
+ commandsEnum.push(commandId);
2134
+ commandsEnumDescriptions.push(description);
2135
+ commandsEnum.push(`-${commandId}`);
2136
+ commandsEnumDescriptions.push(description);
2137
+ }
2138
+ }
2139
+ };
2140
+ const allCommands = CommandsRegistry.getCommands();
2141
+ for (const [commandId, command] of allCommands) {
2142
+ const commandDescription = command.description;
2143
+ addKnownCommand(commandId, commandDescription ? commandDescription.description : undefined);
2144
+ if (!commandDescription || !commandDescription.args || commandDescription.args.length !== 1 || !commandDescription.args[0].schema) {
2145
+ continue;
2146
+ }
2147
+ const argsSchema = commandDescription.args[0].schema;
2148
+ const argsRequired = ((typeof commandDescription.args[0].isOptional !== 'undefined')
2149
+ ? (!commandDescription.args[0].isOptional)
2150
+ : (Array.isArray(argsSchema.required) && argsSchema.required.length > 0));
2151
+ const addition = {
2152
+ 'if': {
2153
+ 'properties': {
2154
+ 'command': { 'const': commandId }
2155
+ }
2156
+ },
2157
+ 'then': {
2158
+ 'required': [].concat(argsRequired ? ['args'] : []),
2159
+ 'properties': {
2160
+ 'args': argsSchema
2161
+ }
2162
+ }
2163
+ };
2164
+ commandsSchemas.push(addition);
2165
+ }
2166
+ const menuCommands = MenuRegistry.getCommands();
2167
+ for (const commandId of ( (menuCommands.keys()))) {
2168
+ addKnownCommand(commandId);
2169
+ }
2170
+ commandsSchemas.push(...additionalContributions);
2171
+ schemaRegistry.notifySchemaChanged(schemaId);
2172
+ }
2173
+ const configurationRegistry = ( (Registry.as(Extensions$1.Configuration)));
2174
+ const keyboardConfiguration = {
2175
+ 'id': 'keyboard',
2176
+ 'order': 15,
2177
+ 'type': 'object',
2178
+ 'title': ( (localize('keyboardConfigurationTitle', "Keyboard"))),
2179
+ 'properties': {
2180
+ 'keyboard.dispatch': {
2181
+ scope: 1 ,
2182
+ type: 'string',
2183
+ enum: ['code', 'keyCode'],
2184
+ default: 'code',
2185
+ markdownDescription: ( (localize(
2186
+ 'dispatch',
2187
+ "Controls the dispatching logic for key presses to use either `code` (recommended) or `keyCode`."
2188
+ ))),
2189
+ included: OS === 2 || OS === 3
2190
+ }
2191
+ }
2192
+ };
2193
+ configurationRegistry.registerConfiguration(keyboardConfiguration);
2194
+ let CommandsQuickAccessProvider = class CommandsQuickAccessProvider extends AbstractEditorCommandsQuickAccessProvider {
2195
+ constructor(editorService, menuService, extensionService, instantiationService, keybindingService, commandService, telemetryService, dialogService, configurationService, editorGroupService, preferencesService) {
2196
+ super({
2197
+ showAlias: !Language.isDefaultVariant(),
2198
+ noResultsPick: {
2199
+ label: ( (localize('noCommandResults', "No matching commands"))),
2200
+ commandId: ''
2201
+ }
2202
+ }, instantiationService, keybindingService, commandService, telemetryService, dialogService);
2203
+ this.editorService = editorService;
2204
+ this.menuService = menuService;
2205
+ this.extensionService = extensionService;
2206
+ this.configurationService = configurationService;
2207
+ this.editorGroupService = editorGroupService;
2208
+ this.preferencesService = preferencesService;
2209
+ this.extensionRegistrationRace = Promise.race([
2210
+ timeout(800),
2211
+ this.extensionService.whenInstalledExtensionsRegistered()
2212
+ ]);
2213
+ }
2214
+ get activeTextEditorControl() { return this.editorService.activeTextEditorControl; }
2215
+ get defaultFilterValue() {
2216
+ if (this.configuration.preserveInput) {
2217
+ return DefaultQuickAccessFilterValue.LAST;
2218
+ }
2219
+ return undefined;
2220
+ }
2221
+ get configuration() {
2222
+ const commandPaletteConfig = this.configurationService.getValue().workbench.commandPalette;
2223
+ return {
2224
+ preserveInput: commandPaletteConfig.preserveInput
2225
+ };
2226
+ }
2227
+ async getCommandPicks(disposables, token) {
2228
+ await this.extensionRegistrationRace;
2229
+ if (token.isCancellationRequested) {
2230
+ return [];
2231
+ }
2232
+ return [
2233
+ ...this.getCodeEditorCommandPicks(),
2234
+ ...this.getGlobalCommandPicks(disposables)
2235
+ ].map(c => ({
2236
+ ...c,
2237
+ buttons: [{
2238
+ iconClass: Codicon.gear.classNames,
2239
+ tooltip: ( (localize('configure keybinding', "Configure Keybinding"))),
2240
+ }],
2241
+ trigger: () => {
2242
+ this.preferencesService.openGlobalKeybindingSettings(false, { query: `@command:${c.commandId}` });
2243
+ return TriggerAction.CLOSE_PICKER;
2244
+ },
2245
+ }));
2246
+ }
2247
+ getGlobalCommandPicks(disposables) {
2248
+ const globalCommandPicks = [];
2249
+ const scopedContextKeyService = this.editorService.activeEditorPane?.scopedContextKeyService || this.editorGroupService.activeGroup.scopedContextKeyService;
2250
+ const globalCommandsMenu = this.menuService.createMenu(MenuId.CommandPalette, scopedContextKeyService);
2251
+ const globalCommandsMenuActions = globalCommandsMenu.getActions()
2252
+ .reduce((r, [, actions]) => [...r, ...actions], [])
2253
+ .filter(action => action instanceof MenuItemAction && action.enabled);
2254
+ for (const action of globalCommandsMenuActions) {
2255
+ let label = (typeof action.item.title === 'string' ? action.item.title : action.item.title.value) || action.item.id;
2256
+ const category = typeof action.item.category === 'string' ? action.item.category : action.item.category?.value;
2257
+ if (category) {
2258
+ label = ( (localize('commandWithCategory', "{0}: {1}", category, label)));
2259
+ }
2260
+ const aliasLabel = typeof action.item.title !== 'string' ? action.item.title.original : undefined;
2261
+ const aliasCategory = (category && action.item.category && typeof action.item.category !== 'string') ? action.item.category.original : undefined;
2262
+ const commandAlias = (aliasLabel && category) ?
2263
+ aliasCategory ? `${aliasCategory}: ${aliasLabel}` : `${category}: ${aliasLabel}` :
2264
+ aliasLabel;
2265
+ globalCommandPicks.push({
2266
+ commandId: action.item.id,
2267
+ commandAlias,
2268
+ label: stripIcons(label)
2269
+ });
2270
+ }
2271
+ globalCommandsMenu.dispose();
2272
+ disposables.add(toDisposable(() => dispose(globalCommandsMenuActions)));
2273
+ return globalCommandPicks;
2274
+ }
2275
+ };
2276
+ CommandsQuickAccessProvider = ( (__decorate([
2277
+ ( (__param(0, IEditorService))),
2278
+ ( (__param(1, IMenuService))),
2279
+ ( (__param(2, IExtensionService))),
2280
+ ( (__param(3, IInstantiationService))),
2281
+ ( (__param(4, IKeybindingService))),
2282
+ ( (__param(5, ICommandService))),
2283
+ ( (__param(6, ITelemetryService))),
2284
+ ( (__param(7, IDialogService))),
2285
+ ( (__param(8, IConfigurationService))),
2286
+ ( (__param(9, IEditorGroupsService))),
2287
+ ( (__param(10, IPreferencesService)))
2288
+ ], CommandsQuickAccessProvider)));
2289
+ let DelegateStandaloneKeybindingService = class DelegateStandaloneKeybindingService extends createInjectedClass(StandaloneKeybindingService) {
2290
+ constructor(instantiationService) {
2291
+ super(instantiationService);
2292
+ this.delegate = instantiationService.createInstance(WorkbenchKeybindingService);
2293
+ this._cachedOverridenResolver = null;
2294
+ this.onDidUpdateKeybindings(() => {
2295
+ this._cachedOverridenResolver = null;
2296
+ });
2297
+ this.delegate.onDidUpdateKeybindings(() => {
2298
+ this._cachedOverridenResolver = null;
2299
+ });
2300
+ }
2301
+ _getResolver() {
2302
+ if (this._cachedOverridenResolver == null) {
2303
+ const overrides = this['_toNormalizedKeybindingItems'](this['_dynamicKeybindings'], false);
2304
+ this._cachedOverridenResolver = new KeybindingResolver(
2305
+ [...this.delegate['_getResolver']().getKeybindings()], overrides, (str) => this._log(str));
2306
+ }
2307
+ return this._cachedOverridenResolver;
2308
+ }
2309
+ };
2310
+ DelegateStandaloneKeybindingService = ( __decorate([
2311
+ ( __param(0, IInstantiationService))
2312
+ ], DelegateStandaloneKeybindingService));
2313
+ const quickAccessRegistry = ( Registry.as(Extensions$2.Quickaccess));
2314
+ const provider = quickAccessRegistry.getQuickAccessProviders().find(provider => provider.ctor === StandaloneCommandsQuickAccessProvider);
2315
+ if (provider != null) {
2316
+ provider.ctor = class extends CommandsQuickAccessProvider {
2317
+ get defaultFilterValue() { return undefined; }
2318
+ async getCommandPicks(disposables, token) {
2319
+ return (await super.getCommandPicks(disposables, token)).map(pick => {
2320
+ pick.buttons = [];
2321
+ return pick;
2322
+ });
2323
+ }
2324
+ };
2325
+ }
2326
+ const keybindingsExtensionPoint = getExtensionPoint('keybindings');
2327
+ const commandsExtensionPoint = getExtensionPoint('commands');
2328
+ function setKeybindings(grammars, extension = Services.get().extension ?? DEFAULT_EXTENSION) {
2329
+ keybindingsExtensionPoint.acceptUsers([{
2330
+ description: extension,
2331
+ value: grammars,
2332
+ collector: new ExtensionMessageCollector(consoleExtensionMessageHandler, extension, keybindingsExtensionPoint.name)
2333
+ }]);
2334
+ }
2335
+ function setCommands(keybindings, extension = Services.get().extension ?? DEFAULT_EXTENSION) {
2336
+ commandsExtensionPoint.acceptUsers([{
2337
+ description: extension,
2338
+ value: keybindings,
2339
+ collector: new ExtensionMessageCollector(consoleExtensionMessageHandler, extension, keybindingsExtensionPoint.name)
2340
+ }]);
2341
+ }
2342
+ function updateUserKeybindings(keybindingsJson) {
2343
+ const userDataProfilesService = StandaloneServices.get(IUserDataProfilesService);
2344
+ void StandaloneServices.get(IFileService).writeFile(userDataProfilesService.defaultProfile.keybindingsResource, VSBuffer.fromString(keybindingsJson));
2345
+ }
2346
+ function getServiceOverride() {
2347
+ return {
2348
+ ...getServiceOverride$1(),
2349
+ [( IKeybindingService.toString())]: new SyncDescriptor(DelegateStandaloneKeybindingService)
2350
+ };
2351
+ }
2352
+ export { getServiceOverride as default, setCommands, setKeybindings, updateUserKeybindings };