@codingame/monaco-vscode-api 1.69.24 → 1.76.0-next.2

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.
@@ -1,17 +1,16 @@
1
- import { _ as __decorate, a as __param, E as Emitter } from './workspace.js';
2
- import { i as index, a as flatten, b as parse, g as getNodeType } from './polyfill.js';
3
- import { i as isProposedApiEnabled, c as IKeyboardLayoutService, d as IExtensionService, e as IPreferencesService, g as getKeyboardLayoutId, f as IUserDataProfileService, M as MacLinuxFallbackKeyboardMapper } from './missing-services.js';
1
+ import { _ as __decorate, a as __param, E as Emitter } from './contextkey.js';
2
+ import { i as index, f as flatten, p as parse, g as getNodeType } from './polyfill.js';
3
+ import { i as isProposedApiEnabled, b as IKeyboardLayoutService, c as IExtensionService, d as IPreferencesService, g as getKeyboardLayoutId, e as IUserDataProfileService, F as FallbackKeyboardMapper } from './missing-services.js';
4
+ import { KeyCodeChord, ScanCodeChord, Keybinding } from 'monaco-editor/esm/vs/base/common/keybindings.js';
4
5
  import { KeyCodeUtils, IMMUTABLE_CODE_TO_KEY_CODE, NATIVE_WINDOWS_KEY_CODE_TO_KEY_CODE, IMMUTABLE_KEY_CODE_TO_CODE } from 'monaco-editor/esm/vs/base/common/keyCodes.js';
5
- import { SimpleKeybinding, ScanCodeBinding, ChordKeybinding } from 'monaco-editor/esm/vs/base/common/keybindings.js';
6
6
  import { g as getExtensionPoint, E as ExtensionsRegistry, a as ExtensionMessageCollector, c as consoleExtensionMessageHandler } from './tools.js';
7
7
  import { ContextKeyExpr, IContextKeyService } from 'monaco-editor/esm/vs/platform/contextkey/common/contextkey.js';
8
- import { S as Services, r as IUserDataProfilesService, c as IFileService, b as IEditorService, I as IEditorGroupsService, d as IHostService } from './services2.js';
9
- import { MenuRegistry, MenuId, MenuItemAction, IMenuService, isIMenuItem } from 'monaco-editor/esm/vs/platform/actions/common/actions.js';
8
+ import { S as Services, r as IUserDataProfilesService, c as IFileService, b as IEditorService, I as IEditorGroupsService, h as IProductService, d as IHostService } from './services2.js';
10
9
  import { getConfiguredDefaultLocale, localize } from 'monaco-editor/esm/vs/nls.js';
11
- import { ThemeIcon } from 'monaco-editor/esm/vs/platform/theme/common/themeService.js';
10
+ import { ThemeIcon } from 'monaco-editor/esm/vs/base/common/themables.js';
12
11
  import { joinPath, dirname } from 'monaco-editor/esm/vs/base/common/resources.js';
13
- import { Iterable } from 'monaco-editor/esm/vs/base/common/iterator.js';
14
- import { DisposableStore, toDisposable, dispose, Disposable } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
12
+ import { MenuId, MenuRegistry, MenuItemAction, Action2, IMenuService, isIMenuItem } from 'monaco-editor/esm/vs/platform/actions/common/actions.js';
13
+ import { DisposableStore, Disposable } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
15
14
  import { isFalsyOrWhitespace } from 'monaco-editor/esm/vs/base/common/strings.js';
16
15
  import { EditorExtensionsRegistry } from 'monaco-editor/esm/vs/editor/browser/editorExtensions.js';
17
16
  import { ICommandService, CommandsRegistry } from 'monaco-editor/esm/vs/platform/commands/common/commands.js';
@@ -23,19 +22,16 @@ import { BrowserFeatures } from 'monaco-editor/esm/vs/base/browser/canIUse.js';
23
22
  import { UserSettingsLabelProvider, UILabelProvider } from 'monaco-editor/esm/vs/base/common/keybindingLabels.js';
24
23
  import { OS, isMacintosh, isWindows, isLinux } from 'monaco-editor/esm/vs/base/common/platform.js';
25
24
  import { KeybindingResolver } from 'monaco-editor/esm/vs/platform/keybinding/common/keybindingResolver.js';
26
- import { ResolvedKeybindingItem, removeElementsAfterNulls } from 'monaco-editor/esm/vs/platform/keybinding/common/resolvedKeybindingItem.js';
25
+ import { ResolvedKeybindingItem, toEmptyArrayIfContainsNull } from 'monaco-editor/esm/vs/platform/keybinding/common/resolvedKeybindingItem.js';
27
26
  import { ITelemetryService } from 'monaco-editor/esm/vs/platform/telemetry/common/telemetry.js';
28
27
  import { INotificationService } from 'monaco-editor/esm/vs/platform/notification/common/notification.js';
29
- import { IConfigurationService } from 'monaco-editor/esm/vs/platform/configuration/common/configuration.js';
30
28
  import { ILogService } from 'monaco-editor/esm/vs/platform/log/common/log.js';
31
29
  import { timeout, RunOnceScheduler } from 'monaco-editor/esm/vs/base/common/async.js';
32
30
  import { Event } from 'monaco-editor/esm/vs/base/common/event.js';
33
- import { isArray } from 'monaco-editor/esm/vs/base/common/types.js';
34
31
  import { equals } from 'monaco-editor/esm/vs/base/common/objects.js';
35
32
  import { StandardKeyboardEvent } from 'monaco-editor/esm/vs/base/browser/keyboardEvent.js';
36
33
  import { Registry } from 'monaco-editor/esm/vs/platform/registry/common/platform.js';
37
34
  import { Extensions } from 'monaco-editor/esm/vs/platform/jsonschemas/common/jsonContributionRegistry.js';
38
- import { Extensions as Extensions$1 } from 'monaco-editor/esm/vs/platform/configuration/common/configurationRegistry.js';
39
35
  import { AbstractEditorCommandsQuickAccessProvider } from 'monaco-editor/esm/vs/editor/contrib/quickAccess/browser/commandsQuickAccess.js';
40
36
  import { DefaultQuickAccessFilterValue, Extensions as Extensions$2 } from 'monaco-editor/esm/vs/platform/quickinput/common/quickAccess.js';
41
37
  import { Codicon } from 'monaco-editor/esm/vs/base/common/codicons.js';
@@ -44,11 +40,16 @@ import { stripIcons } from 'monaco-editor/esm/vs/base/common/iconLabels.js';
44
40
  import { IInstantiationService } from 'monaco-editor/esm/vs/platform/instantiation/common/instantiation.js';
45
41
  import { IKeybindingService } from 'monaco-editor/esm/vs/platform/keybinding/common/keybinding.js';
46
42
  import { IDialogService } from 'monaco-editor/esm/vs/platform/dialogs/common/dialogs.js';
43
+ import { IConfigurationService } from 'monaco-editor/esm/vs/platform/configuration/common/configuration.js';
44
+ import { isFirefox } from 'monaco-editor/esm/vs/base/browser/browser.js';
45
+ import { IQuickInputService } from 'monaco-editor/esm/vs/platform/quickinput/common/quickInput.js';
46
+ import { Extensions as Extensions$1 } from 'monaco-editor/esm/vs/platform/configuration/common/configurationRegistry.js';
47
47
  import { BaseResolvedKeybinding } from 'monaco-editor/esm/vs/platform/keybinding/common/baseResolvedKeybinding.js';
48
48
  import { IEnvironmentService } from 'monaco-editor/esm/vs/platform/environment/common/environment.js';
49
49
  import { IStorageService } from 'monaco-editor/esm/vs/platform/storage/common/storage.js';
50
50
  import { g as getServiceOverride$1 } from './files.js';
51
- import { be as DEFAULT_EXTENSION } from './extHost.js';
51
+ import getServiceOverride$2, { configurationRegistry as configurationRegistry$2 } from './configuration.js';
52
+ import { bj as DEFAULT_EXTENSION } from './extHost.js';
52
53
  import { c as createInjectedClass } from './injection.js';
53
54
  import { StandaloneCommandsQuickAccessProvider } from 'monaco-editor/esm/vs/editor/standalone/browser/quickAccess/standaloneCommandsQuickAccess.js';
54
55
  import { SyncDescriptor } from 'monaco-editor/esm/vs/platform/instantiation/common/descriptors.js';
@@ -106,9 +107,16 @@ const isChrome$1 = (userAgent$1.indexOf('Chrome') >= 0);
106
107
  (!isChrome$1 && (userAgent$1.indexOf('Safari') >= 0));
107
108
  (userAgent$1.indexOf('Electron/') >= 0);
108
109
  (userAgent$1.indexOf('Android') >= 0);
110
+ let standalone = false;
109
111
  if (window.matchMedia) {
110
- const matchMedia = window.matchMedia('(display-mode: standalone)');
111
- addMatchMediaChangeListener(matchMedia, ({ matches }) => {
112
+ const standaloneMatchMedia = window.matchMedia('(display-mode: standalone) or (display-mode: window-controls-overlay)');
113
+ const fullScreenMatchMedia = window.matchMedia('(display-mode: fullscreen)');
114
+ standalone = standaloneMatchMedia.matches;
115
+ addMatchMediaChangeListener(standaloneMatchMedia, ({ matches }) => {
116
+ if (standalone && fullScreenMatchMedia.matches) {
117
+ return;
118
+ }
119
+ standalone = matches;
112
120
  });
113
121
  }
114
122
  const LANGUAGE_DEFAULT = 'en';
@@ -131,6 +139,7 @@ if (typeof navigator === 'object' && !isElectronRenderer) {
131
139
  _userAgent.indexOf('Macintosh') >= 0;
132
140
  (_userAgent.indexOf('Macintosh') >= 0 || _userAgent.indexOf('iPad') >= 0 || _userAgent.indexOf('iPhone') >= 0) && !!navigator.maxTouchPoints && navigator.maxTouchPoints > 0;
133
141
  _userAgent.indexOf('Linux') >= 0;
142
+ _userAgent?.indexOf('Mobi') >= 0;
134
143
  const configuredLocale = getConfiguredDefaultLocale(
135
144
  ( (localize({ key: 'ensureLoaderPluginIsLoaded', comment: ['{Locked}'] }, '_'))));
136
145
  _locale = configuredLocale || LANGUAGE_DEFAULT;
@@ -666,6 +675,12 @@ const apiMenus = [
666
675
  id: MenuId.ViewItemContext,
667
676
  description: ( (localize('view.itemContext', "The contributed view item context menu")))
668
677
  },
678
+ {
679
+ key: 'comments/comment/editorActions',
680
+ id: MenuId.CommentEditorActions,
681
+ description: ( (localize('commentThread.editorActions', "The contributed comment editor actions"))),
682
+ proposed: 'contribCommentEditorActionsMenu'
683
+ },
669
684
  {
670
685
  key: 'comments/commentThread/title',
671
686
  id: MenuId.CommentThreadTitle,
@@ -680,6 +695,25 @@ const apiMenus = [
680
695
  ))),
681
696
  supportsSubmenus: false
682
697
  },
698
+ {
699
+ key: 'comments/commentThread/additionalActions',
700
+ id: MenuId.CommentThreadAdditionalActions,
701
+ description: ( (localize(
702
+ 'commentThread.actions',
703
+ "The contributed comment thread context menu, rendered as buttons below the comment editor"
704
+ ))),
705
+ supportsSubmenus: false,
706
+ proposed: 'contribCommentThreadAdditionalMenu'
707
+ },
708
+ {
709
+ key: 'comments/commentThread/title/context',
710
+ id: MenuId.CommentThreadTitleContext,
711
+ description: ( (localize(
712
+ 'commentThread.titleContext',
713
+ "The contributed comment thread title's peek context menu, rendered as a right click menu on the comment thread's peek title."
714
+ ))),
715
+ proposed: 'contribCommentPeekContext'
716
+ },
683
717
  {
684
718
  key: 'comments/comment/title',
685
719
  id: MenuId.CommentTitle,
@@ -694,6 +728,15 @@ const apiMenus = [
694
728
  ))),
695
729
  supportsSubmenus: false
696
730
  },
731
+ {
732
+ key: 'comments/commentThread/comment/context',
733
+ id: MenuId.CommentThreadCommentContext,
734
+ description: ( (localize(
735
+ 'comment.commentContext',
736
+ "The contributed comment context menu, rendered as a right click menu on the an individual comment in the comment thread's peek view."
737
+ ))),
738
+ proposed: 'contribCommentPeekContext'
739
+ },
697
740
  {
698
741
  key: 'notebook/toolbar',
699
742
  id: MenuId.NotebookToolbar,
@@ -715,15 +758,6 @@ const apiMenus = [
715
758
  id: MenuId.NotebookCellExecute,
716
759
  description: ( (localize('notebook.cell.execute', "The contributed notebook cell execution menu")))
717
760
  },
718
- {
719
- key: 'notebook/cell/executePrimary',
720
- id: MenuId.NotebookCellExecutePrimary,
721
- description: ( (localize(
722
- 'notebook.cell.executePrimary',
723
- "The contributed primary notebook cell execution button"
724
- ))),
725
- proposed: 'notebookEditor'
726
- },
727
761
  {
728
762
  key: 'interactive/toolbar',
729
763
  id: MenuId.InteractiveToolbar,
@@ -786,6 +820,11 @@ const apiMenus = [
786
820
  ))),
787
821
  supportsSubmenus: false,
788
822
  },
823
+ {
824
+ key: 'webview/context',
825
+ id: MenuId.WebviewContext,
826
+ description: ( (localize('webview.context', "The webview context menu")))
827
+ },
789
828
  {
790
829
  key: 'file/share',
791
830
  id: MenuId.MenubarShare,
@@ -803,16 +842,16 @@ const apiMenus = [
803
842
  proposed: 'inlineCompletionsAdditions'
804
843
  },
805
844
  {
806
- key: 'merge/toolbar',
807
- id: MenuId.MergeToolbar,
808
- description: ( (localize('merge.toolbar', "The prominent botton in the merge editor"))),
809
- proposed: 'contribMergeEditorToolbar'
845
+ key: 'editor/content',
846
+ id: MenuId.EditorContent,
847
+ description: ( (localize('merge.toolbar', "The prominent button in an editor, overlays its content"))),
848
+ proposed: 'contribEditorContentMenu'
810
849
  },
811
850
  {
812
- key: 'webview/context',
813
- id: MenuId.WebviewContext,
814
- description: ( (localize('webview.context', "The webview context menu"))),
815
- proposed: 'contribWebviewContext'
851
+ key: 'mergeEditor/result/title',
852
+ id: MenuId.MergeInputResultToolbar,
853
+ description: ( (localize('menus.mergeEditorResult', "The result toolbar of the merge editor"))),
854
+ proposed: 'contribMergeEditorMenus'
816
855
  },
817
856
  ];
818
857
  var schema$1;
@@ -1234,10 +1273,17 @@ var schema$1;
1234
1273
  const _commandRegistrations = ( (new DisposableStore()));
1235
1274
  const commandsExtensionPoint$1 = ( (ExtensionsRegistry.registerExtensionPoint({
1236
1275
  extensionPoint: 'commands',
1237
- jsonSchema: schema$1.commandsContribution
1276
+ jsonSchema: schema$1.commandsContribution,
1277
+ activationEventsGenerator: (contribs, result) => {
1278
+ for (const contrib of contribs) {
1279
+ if (contrib.command) {
1280
+ result.push(`onCommand:${contrib.command}`);
1281
+ }
1282
+ }
1283
+ }
1238
1284
  })));
1239
1285
  commandsExtensionPoint$1.setHandler(extensions => {
1240
- function handleCommand(userFriendlyCommand, extension, bucket) {
1286
+ function handleCommand(userFriendlyCommand, extension) {
1241
1287
  if (!schema$1.isValidCommand(userFriendlyCommand, extension.collector)) {
1242
1288
  return;
1243
1289
  }
@@ -1261,31 +1307,29 @@ commandsExtensionPoint$1.setHandler(extensions => {
1261
1307
  userFriendlyCommand.command
1262
1308
  ))));
1263
1309
  }
1264
- bucket.push({
1310
+ _commandRegistrations.add(MenuRegistry.addCommand({
1265
1311
  id: command,
1266
1312
  title,
1267
- source: extension.description.displayName ?? extension.description.name,
1313
+ source: { id: extension.description.identifier.value, title: extension.description.displayName ?? extension.description.name },
1268
1314
  shortTitle,
1269
1315
  tooltip: title,
1270
1316
  category,
1271
1317
  precondition: ContextKeyExpr.deserialize(enablement),
1272
1318
  icon: absoluteIcon
1273
- });
1319
+ }));
1274
1320
  }
1275
1321
  _commandRegistrations.clear();
1276
- const newCommands = [];
1277
1322
  for (const extension of extensions) {
1278
1323
  const { value } = extension;
1279
1324
  if (Array.isArray(value)) {
1280
1325
  for (const command of value) {
1281
- handleCommand(command, extension, newCommands);
1326
+ handleCommand(command, extension);
1282
1327
  }
1283
1328
  }
1284
1329
  else {
1285
- handleCommand(value, extension, newCommands);
1330
+ handleCommand(value, extension);
1286
1331
  }
1287
1332
  }
1288
- _commandRegistrations.add(MenuRegistry.addCommands(newCommands));
1289
1333
  });
1290
1334
  const _submenus = ( (new Map()));
1291
1335
  const submenusExtensionPoint = ( (ExtensionsRegistry.registerExtensionPoint({
@@ -1298,7 +1342,7 @@ submenusExtensionPoint.setHandler(extensions => {
1298
1342
  const { value, collector } = extension;
1299
1343
  for (const [, submenuInfo] of Object.entries(value)) {
1300
1344
  if (!schema$1.isValidSubmenu(submenuInfo, collector)) {
1301
- return;
1345
+ continue;
1302
1346
  }
1303
1347
  if (!submenuInfo.id) {
1304
1348
  collector.warn(( (localize(
@@ -1306,7 +1350,7 @@ submenusExtensionPoint.setHandler(extensions => {
1306
1350
  "`{0}` is not a valid submenu identifier",
1307
1351
  submenuInfo.id
1308
1352
  ))));
1309
- return;
1353
+ continue;
1310
1354
  }
1311
1355
  if (_submenus.has(submenuInfo.id)) {
1312
1356
  collector.info(( (localize(
@@ -1314,7 +1358,7 @@ submenusExtensionPoint.setHandler(extensions => {
1314
1358
  "The `{0}` submenu was already previously registered.",
1315
1359
  submenuInfo.id
1316
1360
  ))));
1317
- return;
1361
+ continue;
1318
1362
  }
1319
1363
  if (!submenuInfo.label) {
1320
1364
  collector.warn(( (localize(
@@ -1322,7 +1366,7 @@ submenusExtensionPoint.setHandler(extensions => {
1322
1366
  "`{0}` is not a valid submenu label",
1323
1367
  submenuInfo.label
1324
1368
  ))));
1325
- return;
1369
+ continue;
1326
1370
  }
1327
1371
  let absoluteIcon;
1328
1372
  if (submenuInfo.icon) {
@@ -1345,7 +1389,7 @@ submenusExtensionPoint.setHandler(extensions => {
1345
1389
  }
1346
1390
  }
1347
1391
  });
1348
- const _apiMenusByKey = ( (new Map(Iterable.map(Iterable.from(apiMenus), menu => ([menu.key, menu])))));
1392
+ const _apiMenusByKey = ( (new Map(apiMenus.map(menu => ([menu.key, menu])))));
1349
1393
  const _menuRegistrations = ( (new DisposableStore()));
1350
1394
  const _submenuMenuItems = ( (new Map()));
1351
1395
  const menusExtensionPoint = ( (ExtensionsRegistry.registerExtensionPoint({
@@ -1356,7 +1400,6 @@ const menusExtensionPoint = ( (ExtensionsRegistry.registerExtensionPoint({
1356
1400
  menusExtensionPoint.setHandler(extensions => {
1357
1401
  _menuRegistrations.clear();
1358
1402
  _submenuMenuItems.clear();
1359
- const items = [];
1360
1403
  for (const extension of extensions) {
1361
1404
  const { value, collector } = extension;
1362
1405
  for (const entry of Object.entries(value)) {
@@ -1460,11 +1503,10 @@ menusExtensionPoint.setHandler(extensions => {
1460
1503
  }
1461
1504
  }
1462
1505
  item.when = ContextKeyExpr.deserialize(menuItem.when);
1463
- items.push({ id: menu.id, item });
1506
+ _menuRegistrations.add(MenuRegistry.appendMenuItem(menu.id, item));
1464
1507
  }
1465
1508
  }
1466
1509
  }
1467
- _menuRegistrations.add(MenuRegistry.appendMenuItems(items));
1468
1510
  });
1469
1511
  function getAllUnboundCommands(boundCommands) {
1470
1512
  const unboundCommands = [];
@@ -1562,47 +1604,28 @@ class KeybindingParser {
1562
1604
  key
1563
1605
  };
1564
1606
  }
1565
- static parseSimpleKeybinding(input) {
1566
- const mods = this._readModifiers(input);
1567
- const keyCode = KeyCodeUtils.fromUserSettings(mods.key);
1568
- return [( (new SimpleKeybinding(mods.ctrl, mods.shift, mods.alt, mods.meta, keyCode))), mods.remains];
1569
- }
1570
- static parseKeybinding(input, OS) {
1571
- if (!input) {
1572
- return null;
1573
- }
1574
- const parts = [];
1575
- let part;
1576
- do {
1577
- [part, input] = this.parseSimpleKeybinding(input);
1578
- parts.push(part);
1579
- } while (input.length > 0);
1580
- return (
1581
- (new ChordKeybinding(parts))
1582
- );
1583
- }
1584
- static parseSimpleUserBinding(input) {
1607
+ static parseChord(input) {
1585
1608
  const mods = this._readModifiers(input);
1586
1609
  const scanCodeMatch = mods.key.match(/^\[([^\]]+)\]$/);
1587
1610
  if (scanCodeMatch) {
1588
1611
  const strScanCode = scanCodeMatch[1];
1589
1612
  const scanCode = ScanCodeUtils.lowerCaseToEnum(strScanCode);
1590
- return [( (new ScanCodeBinding(mods.ctrl, mods.shift, mods.alt, mods.meta, scanCode))), mods.remains];
1613
+ return [( (new ScanCodeChord(mods.ctrl, mods.shift, mods.alt, mods.meta, scanCode))), mods.remains];
1591
1614
  }
1592
1615
  const keyCode = KeyCodeUtils.fromUserSettings(mods.key);
1593
- return [( (new SimpleKeybinding(mods.ctrl, mods.shift, mods.alt, mods.meta, keyCode))), mods.remains];
1616
+ return [( (new KeyCodeChord(mods.ctrl, mods.shift, mods.alt, mods.meta, keyCode))), mods.remains];
1594
1617
  }
1595
- static parseUserBinding(input) {
1618
+ static parseKeybinding(input) {
1596
1619
  if (!input) {
1597
- return [];
1620
+ return null;
1598
1621
  }
1599
- const parts = [];
1600
- let part;
1622
+ const chords = [];
1623
+ let chord;
1601
1624
  while (input.length > 0) {
1602
- [part, input] = this.parseSimpleUserBinding(input);
1603
- parts.push(part);
1625
+ [chord, input] = this.parseChord(input);
1626
+ chords.push(chord);
1604
1627
  }
1605
- return parts;
1628
+ return (chords.length > 0 ? (new Keybinding(chords)) : null);
1606
1629
  }
1607
1630
  }
1608
1631
  class KeybindingIO {
@@ -1630,15 +1653,16 @@ class KeybindingIO {
1630
1653
  out.write(' }');
1631
1654
  }
1632
1655
  static readUserKeybindingItem(input) {
1633
- const parts = (typeof input.key === 'string' ? KeybindingParser.parseUserBinding(input.key) : []);
1656
+ const keybinding = (typeof input.key === 'string' ? KeybindingParser.parseKeybinding(input.key) : null);
1634
1657
  const when = (typeof input.when === 'string' ? ContextKeyExpr.deserialize(input.when) : undefined);
1635
1658
  const command = (typeof input.command === 'string' ? input.command : null);
1636
1659
  const commandArgs = (typeof input.args !== 'undefined' ? input.args : undefined);
1637
1660
  return {
1638
- parts: parts,
1639
- command: command,
1640
- commandArgs: commandArgs,
1641
- when: when
1661
+ keybinding,
1662
+ command,
1663
+ commandArgs,
1664
+ when,
1665
+ _source: input
1642
1666
  };
1643
1667
  }
1644
1668
  }
@@ -1665,11 +1689,6 @@ class OutputBuilder {
1665
1689
  return this._lines.join('\n');
1666
1690
  }
1667
1691
  }
1668
- function getDispatchConfig(configurationService) {
1669
- const keyboard = configurationService.getValue('keyboard');
1670
- const r = (keyboard ? keyboard.dispatch : null);
1671
- return (r === 'keyCode' ? 1 : 0) ;
1672
- }
1673
1692
  function isContributedKeyBindingsArray(thing) {
1674
1693
  return Array.isArray(thing);
1675
1694
  }
@@ -1825,26 +1844,16 @@ otherMacNumpadMapping.set(102 , 29 );
1825
1844
  otherMacNumpadMapping.set(103 , 30 );
1826
1845
  otherMacNumpadMapping.set(104 , 21 );
1827
1846
  let WorkbenchKeybindingService = class WorkbenchKeybindingService extends AbstractKeybindingService {
1828
- constructor(contextKeyService, commandService, telemetryService, notificationService, userDataProfileService, configurationService, hostService, extensionService, fileService, logService, keyboardLayoutService) {
1847
+ constructor(contextKeyService, commandService, telemetryService, notificationService, userDataProfileService, hostService, extensionService, fileService, logService, keyboardLayoutService) {
1829
1848
  super(contextKeyService, commandService, telemetryService, notificationService, logService);
1830
1849
  this.hostService = hostService;
1831
1850
  this.keyboardLayoutService = keyboardLayoutService;
1832
1851
  this._contributions = [];
1833
1852
  this.isComposingGlobalContextKey = contextKeyService.createKey('isComposing', false);
1834
1853
  this.updateSchema();
1835
- let dispatchConfig = getDispatchConfig(configurationService);
1836
- configurationService.onDidChangeConfiguration((e) => {
1837
- const newDispatchConfig = getDispatchConfig(configurationService);
1838
- if (dispatchConfig === newDispatchConfig) {
1839
- return;
1840
- }
1841
- dispatchConfig = newDispatchConfig;
1842
- this._keyboardMapper = this.keyboardLayoutService.getKeyboardMapper(dispatchConfig);
1843
- this.updateResolver();
1844
- });
1845
- this._keyboardMapper = this.keyboardLayoutService.getKeyboardMapper(dispatchConfig);
1854
+ this._keyboardMapper = this.keyboardLayoutService.getKeyboardMapper();
1846
1855
  this.keyboardLayoutService.onDidChangeKeyboardLayout(() => {
1847
- this._keyboardMapper = this.keyboardLayoutService.getKeyboardMapper(dispatchConfig);
1856
+ this._keyboardMapper = this.keyboardLayoutService.getKeyboardMapper();
1848
1857
  this.updateResolver();
1849
1858
  });
1850
1859
  this._cachedResolver = null;
@@ -1913,20 +1922,20 @@ let WorkbenchKeybindingService = class WorkbenchKeybindingService extends Abstra
1913
1922
  updateSchema() {
1914
1923
  updateSchema(flatten(this._contributions.map(x => x.getSchemaAdditions())));
1915
1924
  }
1916
- _printUserBinding(parts) {
1917
- return UserSettingsLabelProvider.toLabel(OS, parts, (part) => {
1918
- if (part instanceof SimpleKeybinding) {
1925
+ _printKeybinding(keybinding) {
1926
+ return UserSettingsLabelProvider.toLabel(OS, keybinding.chords, (chord) => {
1927
+ if (chord instanceof KeyCodeChord) {
1919
1928
  return (
1920
- (KeyCodeUtils.toString(part.keyCode))
1929
+ (KeyCodeUtils.toString(chord.keyCode))
1921
1930
  );
1922
1931
  }
1923
1932
  return (
1924
- (ScanCodeUtils.toString(part.scanCode))
1933
+ (ScanCodeUtils.toString(chord.scanCode))
1925
1934
  );
1926
1935
  }) || '[null]';
1927
1936
  }
1928
1937
  _printResolvedKeybinding(resolvedKeybinding) {
1929
- return resolvedKeybinding.getDispatchParts().map(x => x || '[null]').join(' ');
1938
+ return resolvedKeybinding.getDispatchChords().map(x => x || '[null]').join(' ');
1930
1939
  }
1931
1940
  _printResolvedKeybindings(output, input, resolvedKeybindings) {
1932
1941
  const padLength = 35;
@@ -1946,29 +1955,28 @@ let WorkbenchKeybindingService = class WorkbenchKeybindingService extends Abstra
1946
1955
  const result = [];
1947
1956
  result.push(`Default Resolved Keybindings (unique only):`);
1948
1957
  for (const item of KeybindingsRegistry.getDefaultKeybindings()) {
1949
- if (!item.keybinding || item.keybinding.length === 0) {
1958
+ if (!item.keybinding) {
1950
1959
  continue;
1951
1960
  }
1952
- const input = this._printUserBinding(item.keybinding);
1961
+ const input = this._printKeybinding(item.keybinding);
1953
1962
  if (seenBindings.has(input)) {
1954
1963
  continue;
1955
1964
  }
1956
1965
  seenBindings.add(input);
1957
- const resolvedKeybindings = this._keyboardMapper.resolveUserBinding(item.keybinding);
1966
+ const resolvedKeybindings = this._keyboardMapper.resolveKeybinding(item.keybinding);
1958
1967
  this._printResolvedKeybindings(result, input, resolvedKeybindings);
1959
1968
  }
1960
1969
  result.push(`User Resolved Keybindings (unique only):`);
1961
- for (const _item of this.userKeybindings.keybindings) {
1962
- const item = KeybindingIO.readUserKeybindingItem(_item);
1963
- if (!item.parts || item.parts.length === 0) {
1970
+ for (const item of this.userKeybindings.keybindings) {
1971
+ if (!item.keybinding) {
1964
1972
  continue;
1965
1973
  }
1966
- const input = _item.key;
1974
+ const input = item._source.key;
1967
1975
  if (seenBindings.has(input)) {
1968
1976
  continue;
1969
1977
  }
1970
1978
  seenBindings.add(input);
1971
- const resolvedKeybindings = this._keyboardMapper.resolveUserBinding(item.parts);
1979
+ const resolvedKeybindings = this._keyboardMapper.resolveKeybinding(item.keybinding);
1972
1980
  this._printResolvedKeybindings(result, input, resolvedKeybindings);
1973
1981
  }
1974
1982
  return result.join('\n');
@@ -1997,7 +2005,7 @@ let WorkbenchKeybindingService = class WorkbenchKeybindingService extends Abstra
1997
2005
  _getResolver() {
1998
2006
  if (!this._cachedResolver) {
1999
2007
  const defaults = this._resolveKeybindingItems(KeybindingsRegistry.getDefaultKeybindings(), true);
2000
- const overrides = this._resolveUserKeybindingItems(this.userKeybindings.keybindings.map((k) => KeybindingIO.readUserKeybindingItem(k)), false);
2008
+ const overrides = this._resolveUserKeybindingItems(this.userKeybindings.keybindings, false);
2001
2009
  this._cachedResolver = ( (new KeybindingResolver(defaults, overrides, (str) => this._log(str))));
2002
2010
  }
2003
2011
  return this._cachedResolver;
@@ -2026,7 +2034,7 @@ let WorkbenchKeybindingService = class WorkbenchKeybindingService extends Abstra
2026
2034
  if (this._assertBrowserConflicts(keybinding, item.command)) {
2027
2035
  continue;
2028
2036
  }
2029
- const resolvedKeybindings = this._keyboardMapper.resolveUserBinding(keybinding);
2037
+ const resolvedKeybindings = this._keyboardMapper.resolveKeybinding(keybinding);
2030
2038
  for (let i = resolvedKeybindings.length - 1; i >= 0; i--) {
2031
2039
  const resolvedKeybinding = resolvedKeybindings[i];
2032
2040
  result[resultLen++] = ( (new ResolvedKeybindingItem(
@@ -2048,12 +2056,11 @@ let WorkbenchKeybindingService = class WorkbenchKeybindingService extends Abstra
2048
2056
  let resultLen = 0;
2049
2057
  for (const item of items) {
2050
2058
  const when = item.when || undefined;
2051
- const parts = item.parts;
2052
- if (parts.length === 0) {
2059
+ if (!item.keybinding) {
2053
2060
  result[resultLen++] = ( (new ResolvedKeybindingItem(undefined, item.command, item.commandArgs, when, isDefault, null, false)));
2054
2061
  }
2055
2062
  else {
2056
- const resolvedKeybindings = this._keyboardMapper.resolveUserBinding(parts);
2063
+ const resolvedKeybindings = this._keyboardMapper.resolveKeybinding(item.keybinding);
2057
2064
  for (const resolvedKeybinding of resolvedKeybindings) {
2058
2065
  result[resultLen++] = ( (new ResolvedKeybindingItem(
2059
2066
  resolvedKeybinding,
@@ -2069,44 +2076,44 @@ let WorkbenchKeybindingService = class WorkbenchKeybindingService extends Abstra
2069
2076
  }
2070
2077
  return result;
2071
2078
  }
2072
- _assertBrowserConflicts(kb, commandId) {
2079
+ _assertBrowserConflicts(keybinding, commandId) {
2073
2080
  if (BrowserFeatures.keyboard === 0 ) {
2074
2081
  return false;
2075
2082
  }
2076
2083
  if (BrowserFeatures.keyboard === 1 && isFullscreen()) {
2077
2084
  return false;
2078
2085
  }
2079
- for (const part of kb) {
2080
- if (!part.metaKey && !part.altKey && !part.ctrlKey && !part.shiftKey) {
2086
+ for (const chord of keybinding.chords) {
2087
+ if (!chord.metaKey && !chord.altKey && !chord.ctrlKey && !chord.shiftKey) {
2081
2088
  continue;
2082
2089
  }
2083
2090
  const modifiersMask = 2048 | 512 | 1024 ;
2084
2091
  let partModifiersMask = 0;
2085
- if (part.metaKey) {
2092
+ if (chord.metaKey) {
2086
2093
  partModifiersMask |= 2048 ;
2087
2094
  }
2088
- if (part.shiftKey) {
2095
+ if (chord.shiftKey) {
2089
2096
  partModifiersMask |= 1024 ;
2090
2097
  }
2091
- if (part.altKey) {
2098
+ if (chord.altKey) {
2092
2099
  partModifiersMask |= 512 ;
2093
2100
  }
2094
- if (part.ctrlKey && OS === 2 ) {
2101
+ if (chord.ctrlKey && OS === 2 ) {
2095
2102
  partModifiersMask |= 256 ;
2096
2103
  }
2097
2104
  if ((partModifiersMask & modifiersMask) === ((2048 | 512) )) {
2098
- if (part instanceof ScanCodeBinding && ((part.scanCode === 86 || part.scanCode === 85) )) {
2105
+ if (chord instanceof ScanCodeChord && ((chord.scanCode === 86 || chord.scanCode === 85) )) {
2099
2106
  return true;
2100
2107
  }
2101
- if (part instanceof SimpleKeybinding && ((part.keyCode === 15 || part.keyCode === 17) )) {
2108
+ if (chord instanceof KeyCodeChord && ((chord.keyCode === 15 || chord.keyCode === 17) )) {
2102
2109
  return true;
2103
2110
  }
2104
2111
  }
2105
2112
  if ((partModifiersMask & modifiersMask) === 2048 ) {
2106
- if (part instanceof ScanCodeBinding && ((part.scanCode >= 36 && part.scanCode <= 45) )) {
2113
+ if (chord instanceof ScanCodeChord && ((chord.scanCode >= 36 && chord.scanCode <= 45) )) {
2107
2114
  return true;
2108
2115
  }
2109
- if (part instanceof SimpleKeybinding && ((part.keyCode >= 21 && part.keyCode <= 30) )) {
2116
+ if (chord instanceof KeyCodeChord && ((chord.keyCode >= 21 && chord.keyCode <= 30) )) {
2110
2117
  return true;
2111
2118
  }
2112
2119
  }
@@ -2121,8 +2128,8 @@ let WorkbenchKeybindingService = class WorkbenchKeybindingService extends Abstra
2121
2128
  return this._keyboardMapper.resolveKeyboardEvent(keyboardEvent);
2122
2129
  }
2123
2130
  resolveUserBinding(userBinding) {
2124
- const parts = KeybindingParser.parseUserBinding(userBinding);
2125
- return this._keyboardMapper.resolveUserBinding(parts);
2131
+ const keybinding = KeybindingParser.parseKeybinding(userBinding);
2132
+ return (keybinding ? this._keyboardMapper.resolveKeybinding(keybinding) : []);
2126
2133
  }
2127
2134
  _handleKeybindingsExtensionPointUser(extensionId, isBuiltin, keybindings, collector, result) {
2128
2135
  if (isContributedKeyBindingsArray(keybindings)) {
@@ -2199,7 +2206,7 @@ let WorkbenchKeybindingService = class WorkbenchKeybindingService extends Abstra
2199
2206
  args,
2200
2207
  when: fullWhen,
2201
2208
  weight: weight,
2202
- keybinding: KeybindingParser.parseUserBinding(keybinding),
2209
+ keybinding: KeybindingParser.parseKeybinding(keybinding),
2203
2210
  extensionId: extensionId.value,
2204
2211
  isBuiltinExtension: isBuiltin
2205
2212
  };
@@ -2274,18 +2281,19 @@ WorkbenchKeybindingService = ( (__decorate([
2274
2281
  ( (__param(2, ITelemetryService))),
2275
2282
  ( (__param(3, INotificationService))),
2276
2283
  ( (__param(4, IUserDataProfileService))),
2277
- ( (__param(5, IConfigurationService))),
2278
- ( (__param(6, IHostService))),
2279
- ( (__param(7, IExtensionService))),
2280
- ( (__param(8, IFileService))),
2281
- ( (__param(9, ILogService))),
2282
- ( (__param(10, IKeyboardLayoutService)))
2284
+ ( (__param(5, IHostService))),
2285
+ ( (__param(6, IExtensionService))),
2286
+ ( (__param(7, IFileService))),
2287
+ ( (__param(8, ILogService))),
2288
+ ( (__param(9, IKeyboardLayoutService)))
2283
2289
  ], WorkbenchKeybindingService)));
2284
2290
  class UserKeybindings extends Disposable {
2291
+ get keybindings() { return this._keybindings; }
2285
2292
  constructor(userDataProfileService, fileService, logService) {
2286
2293
  super();
2287
2294
  this.userDataProfileService = userDataProfileService;
2288
2295
  this.fileService = fileService;
2296
+ this._rawKeybindings = [];
2289
2297
  this._keybindings = [];
2290
2298
  this.watchDisposables = this._register(( (new DisposableStore())));
2291
2299
  this._onDidChange = this._register(( (new Emitter())));
@@ -2308,7 +2316,6 @@ class UserKeybindings extends Disposable {
2308
2316
  }));
2309
2317
  this._register(userDataProfileService.onDidChangeCurrentProfile(e => e.join(this.whenCurrentProfieChanged(e))));
2310
2318
  }
2311
- get keybindings() { return this._keybindings; }
2312
2319
  async whenCurrentProfieChanged(e) {
2313
2320
  if (e.preserveData) {
2314
2321
  if (await this.fileService.exists(e.previous.keybindingsResource)) {
@@ -2327,16 +2334,23 @@ class UserKeybindings extends Disposable {
2327
2334
  await this.reload();
2328
2335
  }
2329
2336
  async reload() {
2330
- const existing = this._keybindings;
2337
+ const newKeybindings = await this.readUserKeybindings();
2338
+ if (equals(this._rawKeybindings, newKeybindings)) {
2339
+ return false;
2340
+ }
2341
+ this._rawKeybindings = newKeybindings;
2342
+ this._keybindings = this._rawKeybindings.map((k) => KeybindingIO.readUserKeybindingItem(k));
2343
+ return true;
2344
+ }
2345
+ async readUserKeybindings() {
2331
2346
  try {
2332
2347
  const content = await this.fileService.readFile(this.userDataProfileService.currentProfile.keybindingsResource);
2333
2348
  const value = parse(( (content.value.toString())));
2334
- this._keybindings = isArray(value) ? value : [];
2349
+ return Array.isArray(value) ? value : [];
2335
2350
  }
2336
2351
  catch (e) {
2337
- this._keybindings = [];
2352
+ return [];
2338
2353
  }
2339
- return existing ? !equals(existing, this._keybindings) : true;
2340
2354
  }
2341
2355
  }
2342
2356
  const schemaId = 'vscode://schemas/keybindings';
@@ -2451,67 +2465,46 @@ function updateSchema(additionalContributions) {
2451
2465
  commandsSchemas.push(...additionalContributions);
2452
2466
  schemaRegistry.notifySchemaChanged(schemaId);
2453
2467
  }
2454
- const configurationRegistry$1 = ( (Registry.as(Extensions$1.Configuration)));
2455
- const keyboardConfiguration$1 = {
2456
- 'id': 'keyboard',
2457
- 'order': 15,
2458
- 'type': 'object',
2459
- 'title': ( (localize('keyboardConfigurationTitle', "Keyboard"))),
2460
- 'properties': {
2461
- 'keyboard.dispatch': {
2462
- scope: 1 ,
2463
- type: 'string',
2464
- enum: ['code', 'keyCode'],
2465
- default: 'code',
2466
- markdownDescription: ( (localize(
2467
- 'dispatch',
2468
- "Controls the dispatching logic for key presses to use either `code` (recommended) or `keyCode`."
2469
- ))),
2470
- included: OS === 2 || OS === 3
2471
- }
2472
- }
2473
- };
2474
- configurationRegistry$1.registerConfiguration(keyboardConfiguration$1);
2475
2468
  class WindowsNativeResolvedKeybinding extends BaseResolvedKeybinding {
2476
- constructor(mapper, parts) {
2477
- super(1 , parts);
2469
+ constructor(mapper, chords) {
2470
+ super(1 , chords);
2478
2471
  this._mapper = mapper;
2479
2472
  }
2480
- _getLabel(keybinding) {
2481
- if (keybinding.isDuplicateModifierCase()) {
2473
+ _getLabel(chord) {
2474
+ if (chord.isDuplicateModifierCase()) {
2482
2475
  return '';
2483
2476
  }
2484
- return this._mapper.getUILabelForKeyCode(keybinding.keyCode);
2477
+ return this._mapper.getUILabelForKeyCode(chord.keyCode);
2485
2478
  }
2486
- _getUSLabelForKeybinding(keybinding) {
2487
- if (keybinding.isDuplicateModifierCase()) {
2479
+ _getUSLabelForKeybinding(chord) {
2480
+ if (chord.isDuplicateModifierCase()) {
2488
2481
  return '';
2489
2482
  }
2490
2483
  return (
2491
- (KeyCodeUtils.toString(keybinding.keyCode))
2484
+ (KeyCodeUtils.toString(chord.keyCode))
2492
2485
  );
2493
2486
  }
2494
2487
  getUSLabel() {
2495
- return UILabelProvider.toLabel(this._os, this._parts, (keybinding) => this._getUSLabelForKeybinding(keybinding));
2488
+ return UILabelProvider.toLabel(this._os, this._chords, (keybinding) => this._getUSLabelForKeybinding(keybinding));
2496
2489
  }
2497
- _getAriaLabel(keybinding) {
2498
- if (keybinding.isDuplicateModifierCase()) {
2490
+ _getAriaLabel(chord) {
2491
+ if (chord.isDuplicateModifierCase()) {
2499
2492
  return '';
2500
2493
  }
2501
- return this._mapper.getAriaLabelForKeyCode(keybinding.keyCode);
2494
+ return this._mapper.getAriaLabelForKeyCode(chord.keyCode);
2502
2495
  }
2503
- _getElectronAccelerator(keybinding) {
2504
- return this._mapper.getElectronAcceleratorForKeyBinding(keybinding);
2496
+ _getElectronAccelerator(chord) {
2497
+ return this._mapper.getElectronAcceleratorForKeyBinding(chord);
2505
2498
  }
2506
- _getUserSettingsLabel(keybinding) {
2507
- if (keybinding.isDuplicateModifierCase()) {
2499
+ _getUserSettingsLabel(chord) {
2500
+ if (chord.isDuplicateModifierCase()) {
2508
2501
  return '';
2509
2502
  }
2510
- const result = this._mapper.getUserSettingsLabelForKeyCode(keybinding.keyCode);
2503
+ const result = this._mapper.getUserSettingsLabelForKeyCode(chord.keyCode);
2511
2504
  return (result ? result.toLowerCase() : result);
2512
2505
  }
2513
- _isWYSIWYG(keybinding) {
2514
- return this.__isWYSIWYG(keybinding.keyCode);
2506
+ _isWYSIWYG(chord) {
2507
+ return this.__isWYSIWYG(chord.keyCode);
2515
2508
  }
2516
2509
  __isWYSIWYG(keyCode) {
2517
2510
  if (keyCode === 15
@@ -2524,58 +2517,58 @@ class WindowsNativeResolvedKeybinding extends BaseResolvedKeybinding {
2524
2517
  const userSettingsLabel = this._mapper.getUserSettingsLabelForKeyCode(keyCode);
2525
2518
  return (ariaLabel === userSettingsLabel);
2526
2519
  }
2527
- _getDispatchPart(keybinding) {
2528
- if (keybinding.isModifierKey()) {
2520
+ _getChordDispatch(chord) {
2521
+ if (chord.isModifierKey()) {
2529
2522
  return null;
2530
2523
  }
2531
2524
  let result = '';
2532
- if (keybinding.ctrlKey) {
2525
+ if (chord.ctrlKey) {
2533
2526
  result += 'ctrl+';
2534
2527
  }
2535
- if (keybinding.shiftKey) {
2528
+ if (chord.shiftKey) {
2536
2529
  result += 'shift+';
2537
2530
  }
2538
- if (keybinding.altKey) {
2531
+ if (chord.altKey) {
2539
2532
  result += 'alt+';
2540
2533
  }
2541
- if (keybinding.metaKey) {
2534
+ if (chord.metaKey) {
2542
2535
  result += 'meta+';
2543
2536
  }
2544
- result += ( (KeyCodeUtils.toString(keybinding.keyCode)));
2537
+ result += ( (KeyCodeUtils.toString(chord.keyCode)));
2545
2538
  return result;
2546
2539
  }
2547
- _getSingleModifierDispatchPart(keybinding) {
2548
- if (keybinding.keyCode === 5 && !keybinding.shiftKey && !keybinding.altKey && !keybinding.metaKey) {
2540
+ _getSingleModifierChordDispatch(chord) {
2541
+ if (chord.keyCode === 5 && !chord.shiftKey && !chord.altKey && !chord.metaKey) {
2549
2542
  return 'ctrl';
2550
2543
  }
2551
- if (keybinding.keyCode === 4 && !keybinding.ctrlKey && !keybinding.altKey && !keybinding.metaKey) {
2544
+ if (chord.keyCode === 4 && !chord.ctrlKey && !chord.altKey && !chord.metaKey) {
2552
2545
  return 'shift';
2553
2546
  }
2554
- if (keybinding.keyCode === 6 && !keybinding.ctrlKey && !keybinding.shiftKey && !keybinding.metaKey) {
2547
+ if (chord.keyCode === 6 && !chord.ctrlKey && !chord.shiftKey && !chord.metaKey) {
2555
2548
  return 'alt';
2556
2549
  }
2557
- if (keybinding.keyCode === 57 && !keybinding.ctrlKey && !keybinding.shiftKey && !keybinding.altKey) {
2550
+ if (chord.keyCode === 57 && !chord.ctrlKey && !chord.shiftKey && !chord.altKey) {
2558
2551
  return 'meta';
2559
2552
  }
2560
2553
  return null;
2561
2554
  }
2562
- static getProducedCharCode(kb, mapping) {
2555
+ static getProducedCharCode(chord, mapping) {
2563
2556
  if (!mapping) {
2564
2557
  return null;
2565
2558
  }
2566
- if (kb.ctrlKey && kb.shiftKey && kb.altKey) {
2559
+ if (chord.ctrlKey && chord.shiftKey && chord.altKey) {
2567
2560
  return mapping.withShiftAltGr;
2568
2561
  }
2569
- if (kb.ctrlKey && kb.altKey) {
2562
+ if (chord.ctrlKey && chord.altKey) {
2570
2563
  return mapping.withAltGr;
2571
2564
  }
2572
- if (kb.shiftKey) {
2565
+ if (chord.shiftKey) {
2573
2566
  return mapping.withShift;
2574
2567
  }
2575
2568
  return mapping.value;
2576
2569
  }
2577
- static getProducedChar(kb, mapping) {
2578
- const char = this.getProducedCharCode(kb, mapping);
2570
+ static getProducedChar(chord, mapping) {
2571
+ const char = this.getProducedCharCode(chord, mapping);
2579
2572
  if (char === null || char.length === 0) {
2580
2573
  return ' --- ';
2581
2574
  }
@@ -2583,9 +2576,10 @@ class WindowsNativeResolvedKeybinding extends BaseResolvedKeybinding {
2583
2576
  }
2584
2577
  }
2585
2578
  class WindowsKeyboardMapper {
2586
- constructor(isUSStandard, rawMappings) {
2579
+ constructor(_isUSStandard, rawMappings, _mapAltGrToCtrlAlt) {
2580
+ this._isUSStandard = _isUSStandard;
2581
+ this._mapAltGrToCtrlAlt = _mapAltGrToCtrlAlt;
2587
2582
  this._keyCodeToLabel = [];
2588
- this.isUSStandard = isUSStandard;
2589
2583
  this._scanCodeToKeyCode = [];
2590
2584
  this._keyCodeToLabel = [];
2591
2585
  this._keyCodeExists = [];
@@ -2736,15 +2730,15 @@ class WindowsKeyboardMapper {
2736
2730
  const ctrlKey = (mod & 0b001) ? true : false;
2737
2731
  const shiftKey = (mod & 0b010) ? true : false;
2738
2732
  const altKey = (mod & 0b100) ? true : false;
2739
- const scanCodeBinding = ( (new ScanCodeBinding(ctrlKey, shiftKey, altKey, false, scanCode)));
2740
- const kb = this._resolveSimpleUserBinding(scanCodeBinding);
2741
- const strKeyCode = (kb ? ( (KeyCodeUtils.toString(kb.keyCode))) : null);
2742
- const resolvedKb = (kb ? ( (new WindowsNativeResolvedKeybinding(this, [kb]))) : null);
2733
+ const scanCodeChord = ( (new ScanCodeChord(ctrlKey, shiftKey, altKey, false, scanCode)));
2734
+ const keyCodeChord = this._resolveChord(scanCodeChord);
2735
+ const strKeyCode = (keyCodeChord ? ( (KeyCodeUtils.toString(keyCodeChord.keyCode))) : null);
2736
+ const resolvedKb = (keyCodeChord ? ( (new WindowsNativeResolvedKeybinding(this, [keyCodeChord]))) : null);
2743
2737
  const outScanCode = `${ctrlKey ? 'Ctrl+' : ''}${shiftKey ? 'Shift+' : ''}${altKey ? 'Alt+' : ''}${strCode}`;
2744
2738
  const ariaLabel = (resolvedKb ? resolvedKb.getAriaLabel() : null);
2745
2739
  const outUILabel = (ariaLabel ? ariaLabel.replace(/Control\+/, 'Ctrl+') : null);
2746
2740
  const outUserSettings = (resolvedKb ? resolvedKb.getUserSettingsLabel() : null);
2747
- const outKey = WindowsNativeResolvedKeybinding.getProducedChar(scanCodeBinding, mapping);
2741
+ const outKey = WindowsNativeResolvedKeybinding.getProducedChar(scanCodeChord, mapping);
2748
2742
  const outKb = (strKeyCode ? `${ctrlKey ? 'Ctrl+' : ''}${shiftKey ? 'Shift+' : ''}${altKey ? 'Alt+' : ''}${strKeyCode}` : null);
2749
2743
  const isWYSIWYG = (resolvedKb ? resolvedKb.isWYSIWYG() : false);
2750
2744
  const outWYSIWYG = (isWYSIWYG ? ' ' : ' NO ');
@@ -2770,73 +2764,66 @@ class WindowsKeyboardMapper {
2770
2764
  return this._getLabelForKeyCode(keyCode);
2771
2765
  }
2772
2766
  getUserSettingsLabelForKeyCode(keyCode) {
2773
- if (this.isUSStandard) {
2767
+ if (this._isUSStandard) {
2774
2768
  return KeyCodeUtils.toUserSettingsUS(keyCode);
2775
2769
  }
2776
2770
  return KeyCodeUtils.toUserSettingsGeneral(keyCode);
2777
2771
  }
2778
- getElectronAcceleratorForKeyBinding(keybinding) {
2779
- return KeyCodeUtils.toElectronAccelerator(keybinding.keyCode);
2772
+ getElectronAcceleratorForKeyBinding(chord) {
2773
+ return KeyCodeUtils.toElectronAccelerator(chord.keyCode);
2780
2774
  }
2781
2775
  _getLabelForKeyCode(keyCode) {
2782
2776
  return this._keyCodeToLabel[keyCode] || ( (KeyCodeUtils.toString(0 )));
2783
2777
  }
2784
- resolveKeybinding(keybinding) {
2785
- const parts = keybinding.parts;
2786
- for (let i = 0, len = parts.length; i < len; i++) {
2787
- const part = parts[i];
2788
- if (!this._keyCodeExists[part.keyCode]) {
2789
- return [];
2790
- }
2791
- }
2792
- return [( (new WindowsNativeResolvedKeybinding(this, parts)))];
2793
- }
2794
2778
  resolveKeyboardEvent(keyboardEvent) {
2795
- const keybinding = ( (new SimpleKeybinding(
2796
- keyboardEvent.ctrlKey,
2779
+ const ctrlKey = keyboardEvent.ctrlKey || (this._mapAltGrToCtrlAlt && keyboardEvent.altGraphKey);
2780
+ const altKey = keyboardEvent.altKey || (this._mapAltGrToCtrlAlt && keyboardEvent.altGraphKey);
2781
+ const chord = ( (new KeyCodeChord(
2782
+ ctrlKey,
2797
2783
  keyboardEvent.shiftKey,
2798
- keyboardEvent.altKey,
2784
+ altKey,
2799
2785
  keyboardEvent.metaKey,
2800
2786
  keyboardEvent.keyCode
2801
2787
  )));
2802
2788
  return (
2803
- (new WindowsNativeResolvedKeybinding(this, [keybinding]))
2789
+ (new WindowsNativeResolvedKeybinding(this, [chord]))
2804
2790
  );
2805
2791
  }
2806
- _resolveSimpleUserBinding(binding) {
2807
- if (!binding) {
2792
+ _resolveChord(chord) {
2793
+ if (!chord) {
2808
2794
  return null;
2809
2795
  }
2810
- if (binding instanceof SimpleKeybinding) {
2811
- if (!this._keyCodeExists[binding.keyCode]) {
2796
+ if (chord instanceof KeyCodeChord) {
2797
+ if (!this._keyCodeExists[chord.keyCode]) {
2812
2798
  return null;
2813
2799
  }
2814
- return binding;
2800
+ return chord;
2815
2801
  }
2816
- const keyCode = this._scanCodeToKeyCode[binding.scanCode] || 0 ;
2802
+ const keyCode = this._scanCodeToKeyCode[chord.scanCode] || 0 ;
2817
2803
  if (keyCode === 0 || !this._keyCodeExists[keyCode]) {
2818
2804
  return null;
2819
2805
  }
2820
2806
  return (
2821
- (new SimpleKeybinding(
2822
- binding.ctrlKey,
2823
- binding.shiftKey,
2824
- binding.altKey,
2825
- binding.metaKey,
2826
- keyCode
2827
- ))
2807
+ (new KeyCodeChord(chord.ctrlKey, chord.shiftKey, chord.altKey, chord.metaKey, keyCode))
2828
2808
  );
2829
2809
  }
2830
- resolveUserBinding(input) {
2831
- const parts = removeElementsAfterNulls(input.map(keybinding => this._resolveSimpleUserBinding(keybinding)));
2832
- if (parts.length > 0) {
2833
- return [( (new WindowsNativeResolvedKeybinding(this, parts)))];
2810
+ resolveKeybinding(keybinding) {
2811
+ const chords = toEmptyArrayIfContainsNull(keybinding.chords.map(chord => this._resolveChord(chord)));
2812
+ if (chords.length > 0) {
2813
+ return [( (new WindowsNativeResolvedKeybinding(this, chords)))];
2834
2814
  }
2835
2815
  return [];
2836
2816
  }
2837
2817
  }
2838
2818
  let CommandsQuickAccessProvider = class CommandsQuickAccessProvider extends AbstractEditorCommandsQuickAccessProvider {
2839
- constructor(editorService, menuService, extensionService, instantiationService, keybindingService, commandService, telemetryService, dialogService, configurationService, editorGroupService, preferencesService) {
2819
+ get activeTextEditorControl() { return this.editorService.activeTextEditorControl; }
2820
+ get defaultFilterValue() {
2821
+ if (this.configuration.preserveInput) {
2822
+ return DefaultQuickAccessFilterValue.LAST;
2823
+ }
2824
+ return undefined;
2825
+ }
2826
+ constructor(editorService, menuService, extensionService, instantiationService, keybindingService, commandService, telemetryService, dialogService, configurationService, editorGroupService, preferencesService, productService) {
2840
2827
  super({
2841
2828
  showAlias: !Language.isDefaultVariant(),
2842
2829
  noResultsPick: {
@@ -2850,36 +2837,43 @@ let CommandsQuickAccessProvider = class CommandsQuickAccessProvider extends Abst
2850
2837
  this.configurationService = configurationService;
2851
2838
  this.editorGroupService = editorGroupService;
2852
2839
  this.preferencesService = preferencesService;
2840
+ this.productService = productService;
2853
2841
  this.extensionRegistrationRace = Promise.race([
2854
2842
  timeout(800),
2855
2843
  this.extensionService.whenInstalledExtensionsRegistered()
2856
2844
  ]);
2857
- }
2858
- get activeTextEditorControl() { return this.editorService.activeTextEditorControl; }
2859
- get defaultFilterValue() {
2860
- if (this.configuration.preserveInput) {
2861
- return DefaultQuickAccessFilterValue.LAST;
2862
- }
2863
- return undefined;
2845
+ this._register(configurationService.onDidChangeConfiguration((e) => this.updateSuggestedCommandIds(e)));
2846
+ this.updateSuggestedCommandIds();
2864
2847
  }
2865
2848
  get configuration() {
2866
2849
  const commandPaletteConfig = this.configurationService.getValue().workbench.commandPalette;
2867
2850
  return {
2868
- preserveInput: commandPaletteConfig.preserveInput
2851
+ preserveInput: commandPaletteConfig.preserveInput,
2852
+ experimental: commandPaletteConfig.experimental
2869
2853
  };
2870
2854
  }
2871
- async getCommandPicks(disposables, token) {
2855
+ updateSuggestedCommandIds(e) {
2856
+ if (e && !e.affectsConfiguration('workbench.commandPalette.experimental.suggestCommands')) {
2857
+ return;
2858
+ }
2859
+ const config = this.configuration;
2860
+ const suggestedCommandIds = config.experimental.suggestCommands && this.productService.commandPaletteSuggestedCommandIds?.length
2861
+ ? ( (new Set(this.productService.commandPaletteSuggestedCommandIds)))
2862
+ : undefined;
2863
+ this.options.suggestedCommandIds = suggestedCommandIds;
2864
+ }
2865
+ async getCommandPicks(token) {
2872
2866
  await this.extensionRegistrationRace;
2873
2867
  if (token.isCancellationRequested) {
2874
2868
  return [];
2875
2869
  }
2876
2870
  return [
2877
2871
  ...this.getCodeEditorCommandPicks(),
2878
- ...this.getGlobalCommandPicks(disposables)
2872
+ ...this.getGlobalCommandPicks()
2879
2873
  ].map(c => ({
2880
2874
  ...c,
2881
2875
  buttons: [{
2882
- iconClass: Codicon.gear.classNames,
2876
+ iconClass: ThemeIcon.asClassName(Codicon.gear),
2883
2877
  tooltip: ( (localize('configure keybinding', "Configure Keybinding"))),
2884
2878
  }],
2885
2879
  trigger: () => {
@@ -2888,7 +2882,7 @@ let CommandsQuickAccessProvider = class CommandsQuickAccessProvider extends Abst
2888
2882
  },
2889
2883
  }));
2890
2884
  }
2891
- getGlobalCommandPicks(disposables) {
2885
+ getGlobalCommandPicks() {
2892
2886
  const globalCommandPicks = [];
2893
2887
  const scopedContextKeyService = this.editorService.activeEditorPane?.scopedContextKeyService || this.editorGroupService.activeGroup.scopedContextKeyService;
2894
2888
  const globalCommandsMenu = this.menuService.createMenu(MenuId.CommandPalette, scopedContextKeyService);
@@ -2913,7 +2907,6 @@ let CommandsQuickAccessProvider = class CommandsQuickAccessProvider extends Abst
2913
2907
  });
2914
2908
  }
2915
2909
  globalCommandsMenu.dispose();
2916
- disposables.add(toDisposable(() => dispose(globalCommandsMenuActions)));
2917
2910
  return globalCommandPicks;
2918
2911
  }
2919
2912
  };
@@ -2928,8 +2921,28 @@ CommandsQuickAccessProvider = ( (__decorate([
2928
2921
  ( (__param(7, IDialogService))),
2929
2922
  ( (__param(8, IConfigurationService))),
2930
2923
  ( (__param(9, IEditorGroupsService))),
2931
- ( (__param(10, IPreferencesService)))
2924
+ ( (__param(10, IPreferencesService))),
2925
+ ( (__param(11, IProductService)))
2932
2926
  ], CommandsQuickAccessProvider)));
2927
+ class ShowAllCommandsAction extends Action2 {
2928
+ constructor() {
2929
+ super({
2930
+ id: ShowAllCommandsAction.ID,
2931
+ title: { value: ( (localize('showTriggerActions', "Show All Commands"))), original: 'Show All Commands' },
2932
+ keybinding: {
2933
+ weight: 200 ,
2934
+ when: undefined,
2935
+ primary: !isFirefox ? ((2048 | 1024 | 46) ) : undefined,
2936
+ secondary: [59 ]
2937
+ },
2938
+ f1: true
2939
+ });
2940
+ }
2941
+ async run(accessor) {
2942
+ accessor.get(IQuickInputService).quickAccess.show(CommandsQuickAccessProvider.PREFIX);
2943
+ }
2944
+ }
2945
+ ShowAllCommandsAction.ID = 'workbench.action.showCommands';
2933
2946
  function deserializeMapping(serializedMapping) {
2934
2947
  const mapping = serializedMapping;
2935
2948
  const ret = {};
@@ -3035,6 +3048,43 @@ class KeymapInfo {
3035
3048
  return true;
3036
3049
  }
3037
3050
  }
3051
+ function readKeyboardConfig(configurationService) {
3052
+ const keyboard = configurationService.getValue('keyboard');
3053
+ const dispatch = ((keyboard?.dispatch === 'keyCode' ? 1 : 0) );
3054
+ const mapAltGrToCtrlAlt = Boolean(keyboard?.mapAltGrToCtrlAlt);
3055
+ return { dispatch, mapAltGrToCtrlAlt };
3056
+ }
3057
+ const configurationRegistry$1 = ( (Registry.as(Extensions$1.Configuration)));
3058
+ const keyboardConfiguration$1 = {
3059
+ 'id': 'keyboard',
3060
+ 'order': 15,
3061
+ 'type': 'object',
3062
+ 'title': ( (localize('keyboardConfigurationTitle', "Keyboard"))),
3063
+ 'properties': {
3064
+ 'keyboard.dispatch': {
3065
+ scope: 1 ,
3066
+ type: 'string',
3067
+ enum: ['code', 'keyCode'],
3068
+ default: 'code',
3069
+ markdownDescription: ( (localize(
3070
+ 'dispatch',
3071
+ "Controls the dispatching logic for key presses to use either `code` (recommended) or `keyCode`."
3072
+ ))),
3073
+ included: OS === 2 || OS === 3
3074
+ },
3075
+ 'keyboard.mapAltGrToCtrlAlt': {
3076
+ scope: 1 ,
3077
+ type: 'boolean',
3078
+ default: false,
3079
+ markdownDescription: ( (localize(
3080
+ 'mapAltGrToCtrlAlt',
3081
+ "Controls if the AltGraph+ modifier should be treated as Ctrl+Alt+."
3082
+ ))),
3083
+ included: OS === 1
3084
+ }
3085
+ }
3086
+ };
3087
+ configurationRegistry$1.registerConfiguration(keyboardConfiguration$1);
3038
3088
  class CachedKeyboardMapper {
3039
3089
  constructor(actual) {
3040
3090
  this._actual = actual;
@@ -3043,6 +3093,9 @@ class CachedKeyboardMapper {
3043
3093
  dumpDebugInfo() {
3044
3094
  return this._actual.dumpDebugInfo();
3045
3095
  }
3096
+ resolveKeyboardEvent(keyboardEvent) {
3097
+ return this._actual.resolveKeyboardEvent(keyboardEvent);
3098
+ }
3046
3099
  resolveKeybinding(keybinding) {
3047
3100
  const hashCode = keybinding.getHashCode();
3048
3101
  const resolved = this._cache.get(hashCode);
@@ -3053,30 +3106,24 @@ class CachedKeyboardMapper {
3053
3106
  }
3054
3107
  return resolved;
3055
3108
  }
3056
- resolveKeyboardEvent(keyboardEvent) {
3057
- return this._actual.resolveKeyboardEvent(keyboardEvent);
3058
- }
3059
- resolveUserBinding(parts) {
3060
- return this._actual.resolveUserBinding(parts);
3061
- }
3062
3109
  }
3063
3110
  const CHAR_CODE_TO_KEY_CODE = [];
3064
3111
  class NativeResolvedKeybinding extends BaseResolvedKeybinding {
3065
- constructor(mapper, os, parts) {
3066
- super(os, parts);
3112
+ constructor(mapper, os, chords) {
3113
+ super(os, chords);
3067
3114
  this._mapper = mapper;
3068
3115
  }
3069
- _getLabel(keybinding) {
3070
- return this._mapper.getUILabelForScanCodeBinding(keybinding);
3116
+ _getLabel(chord) {
3117
+ return this._mapper.getUILabelForScanCodeChord(chord);
3071
3118
  }
3072
- _getAriaLabel(keybinding) {
3073
- return this._mapper.getAriaLabelForScanCodeBinding(keybinding);
3119
+ _getAriaLabel(chord) {
3120
+ return this._mapper.getAriaLabelForScanCodeChord(chord);
3074
3121
  }
3075
- _getElectronAccelerator(keybinding) {
3076
- return this._mapper.getElectronAcceleratorLabelForScanCodeBinding(keybinding);
3122
+ _getElectronAccelerator(chord) {
3123
+ return this._mapper.getElectronAcceleratorLabelForScanCodeChord(chord);
3077
3124
  }
3078
- _getUserSettingsLabel(keybinding) {
3079
- return this._mapper.getUserSettingsLabelForScanCodeBinding(keybinding);
3125
+ _getUserSettingsLabel(chord) {
3126
+ return this._mapper.getUserSettingsLabelForScanCodeChord(chord);
3080
3127
  }
3081
3128
  _isWYSIWYG(binding) {
3082
3129
  if (!binding) {
@@ -3085,8 +3132,8 @@ class NativeResolvedKeybinding extends BaseResolvedKeybinding {
3085
3132
  if (IMMUTABLE_CODE_TO_KEY_CODE[binding.scanCode] !== -1 ) {
3086
3133
  return true;
3087
3134
  }
3088
- const a = this._mapper.getAriaLabelForScanCodeBinding(binding);
3089
- const b = this._mapper.getUserSettingsLabelForScanCodeBinding(binding);
3135
+ const a = this._mapper.getAriaLabelForScanCodeChord(binding);
3136
+ const b = this._mapper.getUserSettingsLabelForScanCodeChord(binding);
3090
3137
  if (!a && !b) {
3091
3138
  return true;
3092
3139
  }
@@ -3095,20 +3142,20 @@ class NativeResolvedKeybinding extends BaseResolvedKeybinding {
3095
3142
  }
3096
3143
  return (a.toLowerCase() === b.toLowerCase());
3097
3144
  }
3098
- _getDispatchPart(keybinding) {
3099
- return this._mapper.getDispatchStrForScanCodeBinding(keybinding);
3145
+ _getChordDispatch(chord) {
3146
+ return this._mapper.getDispatchStrForScanCodeChord(chord);
3100
3147
  }
3101
- _getSingleModifierDispatchPart(keybinding) {
3102
- if (((keybinding.scanCode === 157 || keybinding.scanCode === 161) ) && !keybinding.shiftKey && !keybinding.altKey && !keybinding.metaKey) {
3148
+ _getSingleModifierChordDispatch(chord) {
3149
+ if (((chord.scanCode === 157 || chord.scanCode === 161) ) && !chord.shiftKey && !chord.altKey && !chord.metaKey) {
3103
3150
  return 'ctrl';
3104
3151
  }
3105
- if (((keybinding.scanCode === 159 || keybinding.scanCode === 163) ) && !keybinding.ctrlKey && !keybinding.shiftKey && !keybinding.metaKey) {
3152
+ if (((chord.scanCode === 159 || chord.scanCode === 163) ) && !chord.ctrlKey && !chord.shiftKey && !chord.metaKey) {
3106
3153
  return 'alt';
3107
3154
  }
3108
- if (((keybinding.scanCode === 158 || keybinding.scanCode === 162) ) && !keybinding.ctrlKey && !keybinding.altKey && !keybinding.metaKey) {
3155
+ if (((chord.scanCode === 158 || chord.scanCode === 162) ) && !chord.ctrlKey && !chord.altKey && !chord.metaKey) {
3109
3156
  return 'shift';
3110
3157
  }
3111
- if (((keybinding.scanCode === 160 || keybinding.scanCode === 164) ) && !keybinding.ctrlKey && !keybinding.shiftKey && !keybinding.altKey) {
3158
+ if (((chord.scanCode === 160 || chord.scanCode === 164) ) && !chord.ctrlKey && !chord.shiftKey && !chord.altKey) {
3112
3159
  return 'meta';
3113
3160
  }
3114
3161
  return null;
@@ -3306,11 +3353,12 @@ class ScanCodeKeyCodeMapper {
3306
3353
  }
3307
3354
  }
3308
3355
  class MacLinuxKeyboardMapper {
3309
- constructor(isUSStandard, rawMappings, OS) {
3356
+ constructor(_isUSStandard, rawMappings, _mapAltGrToCtrlAlt, _OS) {
3357
+ this._isUSStandard = _isUSStandard;
3358
+ this._mapAltGrToCtrlAlt = _mapAltGrToCtrlAlt;
3359
+ this._OS = _OS;
3310
3360
  this._scanCodeToLabel = [];
3311
3361
  this._scanCodeToDispatch = [];
3312
- this._isUSStandard = isUSStandard;
3313
- this._OS = OS;
3314
3362
  this._codeInfo = [];
3315
3363
  this._scanCodeKeyCodeMapper = ( (new ScanCodeKeyCodeMapper()));
3316
3364
  this._scanCodeToLabel = [];
@@ -3594,6 +3642,7 @@ class MacLinuxKeyboardMapper {
3594
3642
  shiftKey: scanCodeCombo.shiftKey,
3595
3643
  altKey: scanCodeCombo.altKey,
3596
3644
  metaKey: false,
3645
+ altGraphKey: false,
3597
3646
  keyCode: -1 ,
3598
3647
  code: ( (ScanCodeUtils.toString(scanCode)))
3599
3648
  });
@@ -3603,7 +3652,7 @@ class MacLinuxKeyboardMapper {
3603
3652
  const outUILabel = (ariaLabel ? ariaLabel.replace(/Control\+/, 'Ctrl+') : null);
3604
3653
  const outUserSettings = resolvedKb.getUserSettingsLabel();
3605
3654
  const outElectronAccelerator = resolvedKb.getElectronAccelerator();
3606
- const outDispatchStr = resolvedKb.getDispatchParts()[0];
3655
+ const outDispatchStr = resolvedKb.getDispatchChords()[0];
3607
3656
  const isWYSIWYG = (resolvedKb ? resolvedKb.isWYSIWYG() : false);
3608
3657
  const outWYSIWYG = (isWYSIWYG ? ' ' : ' NO ');
3609
3658
  const kbCombos = this._scanCodeKeyCodeMapper.lookupScanCodeCombo(scanCodeCombo);
@@ -3651,44 +3700,39 @@ class MacLinuxKeyboardMapper {
3651
3700
  }
3652
3701
  return str;
3653
3702
  }
3654
- simpleKeybindingToScanCodeBinding(keybinding) {
3655
- if (keybinding.keyCode === 3 ) {
3656
- return [( (new ScanCodeBinding(
3657
- keybinding.ctrlKey,
3658
- keybinding.shiftKey,
3659
- keybinding.altKey,
3660
- keybinding.metaKey,
3703
+ keyCodeChordToScanCodeChord(chord) {
3704
+ if (chord.keyCode === 3 ) {
3705
+ return [( (new ScanCodeChord(
3706
+ chord.ctrlKey,
3707
+ chord.shiftKey,
3708
+ chord.altKey,
3709
+ chord.metaKey,
3661
3710
  46
3662
3711
  )))];
3663
3712
  }
3664
- const scanCodeCombos = this._scanCodeKeyCodeMapper.lookupKeyCodeCombo(( (new KeyCodeCombo(
3665
- keybinding.ctrlKey,
3666
- keybinding.shiftKey,
3667
- keybinding.altKey,
3668
- keybinding.keyCode
3669
- ))));
3713
+ const scanCodeCombos = this._scanCodeKeyCodeMapper.lookupKeyCodeCombo(( (new KeyCodeCombo(chord.ctrlKey, chord.shiftKey, chord.altKey, chord.keyCode))));
3670
3714
  const result = [];
3671
3715
  for (let i = 0, len = scanCodeCombos.length; i < len; i++) {
3672
3716
  const scanCodeCombo = scanCodeCombos[i];
3673
- result[i] = ( (new ScanCodeBinding(
3717
+ result[i] = ( (new ScanCodeChord(
3674
3718
  scanCodeCombo.ctrlKey,
3675
3719
  scanCodeCombo.shiftKey,
3676
3720
  scanCodeCombo.altKey,
3677
- keybinding.metaKey,
3721
+ chord.metaKey,
3678
3722
  scanCodeCombo.scanCode
3679
3723
  )));
3680
3724
  }
3681
3725
  return result;
3682
3726
  }
3683
- getUILabelForScanCodeBinding(binding) {
3684
- if (!binding) {
3727
+ getUILabelForScanCodeChord(chord) {
3728
+ if (!chord) {
3685
3729
  return null;
3686
3730
  }
3687
- if (binding.isDuplicateModifierCase()) {
3731
+ if (chord.isDuplicateModifierCase()) {
3688
3732
  return '';
3689
3733
  }
3690
3734
  if (this._OS === 2 ) {
3691
- switch (binding.scanCode) {
3735
+ switch (chord.scanCode) {
3692
3736
  case 86 :
3693
3737
  return '←';
3694
3738
  case 88 :
@@ -3699,76 +3743,76 @@ class MacLinuxKeyboardMapper {
3699
3743
  return '↓';
3700
3744
  }
3701
3745
  }
3702
- return this._scanCodeToLabel[binding.scanCode];
3746
+ return this._scanCodeToLabel[chord.scanCode];
3703
3747
  }
3704
- getAriaLabelForScanCodeBinding(binding) {
3705
- if (!binding) {
3748
+ getAriaLabelForScanCodeChord(chord) {
3749
+ if (!chord) {
3706
3750
  return null;
3707
3751
  }
3708
- if (binding.isDuplicateModifierCase()) {
3752
+ if (chord.isDuplicateModifierCase()) {
3709
3753
  return '';
3710
3754
  }
3711
- return this._scanCodeToLabel[binding.scanCode];
3755
+ return this._scanCodeToLabel[chord.scanCode];
3712
3756
  }
3713
- getDispatchStrForScanCodeBinding(keypress) {
3714
- const codeDispatch = this._scanCodeToDispatch[keypress.scanCode];
3757
+ getDispatchStrForScanCodeChord(chord) {
3758
+ const codeDispatch = this._scanCodeToDispatch[chord.scanCode];
3715
3759
  if (!codeDispatch) {
3716
3760
  return null;
3717
3761
  }
3718
3762
  let result = '';
3719
- if (keypress.ctrlKey) {
3763
+ if (chord.ctrlKey) {
3720
3764
  result += 'ctrl+';
3721
3765
  }
3722
- if (keypress.shiftKey) {
3766
+ if (chord.shiftKey) {
3723
3767
  result += 'shift+';
3724
3768
  }
3725
- if (keypress.altKey) {
3769
+ if (chord.altKey) {
3726
3770
  result += 'alt+';
3727
3771
  }
3728
- if (keypress.metaKey) {
3772
+ if (chord.metaKey) {
3729
3773
  result += 'meta+';
3730
3774
  }
3731
3775
  result += codeDispatch;
3732
3776
  return result;
3733
3777
  }
3734
- getUserSettingsLabelForScanCodeBinding(binding) {
3735
- if (!binding) {
3778
+ getUserSettingsLabelForScanCodeChord(chord) {
3779
+ if (!chord) {
3736
3780
  return null;
3737
3781
  }
3738
- if (binding.isDuplicateModifierCase()) {
3782
+ if (chord.isDuplicateModifierCase()) {
3739
3783
  return '';
3740
3784
  }
3741
- const immutableKeyCode = IMMUTABLE_CODE_TO_KEY_CODE[binding.scanCode];
3785
+ const immutableKeyCode = IMMUTABLE_CODE_TO_KEY_CODE[chord.scanCode];
3742
3786
  if (immutableKeyCode !== -1 ) {
3743
3787
  return KeyCodeUtils.toUserSettingsUS(immutableKeyCode).toLowerCase();
3744
3788
  }
3745
- const constantKeyCode = this._scanCodeKeyCodeMapper.guessStableKeyCode(binding.scanCode);
3789
+ const constantKeyCode = this._scanCodeKeyCodeMapper.guessStableKeyCode(chord.scanCode);
3746
3790
  if (constantKeyCode !== -1 ) {
3747
- const reverseBindings = this.simpleKeybindingToScanCodeBinding(( (new SimpleKeybinding(
3748
- binding.ctrlKey,
3749
- binding.shiftKey,
3750
- binding.altKey,
3751
- binding.metaKey,
3791
+ const reverseChords = this.keyCodeChordToScanCodeChord(( (new KeyCodeChord(
3792
+ chord.ctrlKey,
3793
+ chord.shiftKey,
3794
+ chord.altKey,
3795
+ chord.metaKey,
3752
3796
  constantKeyCode
3753
3797
  ))));
3754
- for (let i = 0, len = reverseBindings.length; i < len; i++) {
3755
- const reverseBinding = reverseBindings[i];
3756
- if (reverseBinding.scanCode === binding.scanCode) {
3798
+ for (let i = 0, len = reverseChords.length; i < len; i++) {
3799
+ const reverseChord = reverseChords[i];
3800
+ if (reverseChord.scanCode === chord.scanCode) {
3757
3801
  return KeyCodeUtils.toUserSettingsUS(constantKeyCode).toLowerCase();
3758
3802
  }
3759
3803
  }
3760
3804
  }
3761
- return this._scanCodeToDispatch[binding.scanCode];
3805
+ return this._scanCodeToDispatch[chord.scanCode];
3762
3806
  }
3763
- getElectronAcceleratorLabelForScanCodeBinding(binding) {
3764
- if (!binding) {
3807
+ getElectronAcceleratorLabelForScanCodeChord(chord) {
3808
+ if (!chord) {
3765
3809
  return null;
3766
3810
  }
3767
- const immutableKeyCode = IMMUTABLE_CODE_TO_KEY_CODE[binding.scanCode];
3811
+ const immutableKeyCode = IMMUTABLE_CODE_TO_KEY_CODE[chord.scanCode];
3768
3812
  if (immutableKeyCode !== -1 ) {
3769
3813
  return KeyCodeUtils.toElectronAccelerator(immutableKeyCode);
3770
3814
  }
3771
- const constantKeyCode = this._scanCodeKeyCodeMapper.guessStableKeyCode(binding.scanCode);
3815
+ const constantKeyCode = this._scanCodeKeyCodeMapper.guessStableKeyCode(chord.scanCode);
3772
3816
  if (this._OS === 3 && !this._isUSStandard) {
3773
3817
  const isOEMKey = ((constantKeyCode === 80
3774
3818
  || constantKeyCode === 81
@@ -3788,13 +3832,6 @@ class MacLinuxKeyboardMapper {
3788
3832
  }
3789
3833
  return null;
3790
3834
  }
3791
- resolveKeybinding(keybinding) {
3792
- const chordParts = [];
3793
- for (const part of keybinding.parts) {
3794
- chordParts.push(this.simpleKeybindingToScanCodeBinding(part));
3795
- }
3796
- return this._toResolvedKeybinding(chordParts);
3797
- }
3798
3835
  _toResolvedKeybinding(chordParts) {
3799
3836
  if (chordParts.length === 0) {
3800
3837
  return [];
@@ -3858,29 +3895,25 @@ class MacLinuxKeyboardMapper {
3858
3895
  }
3859
3896
  }
3860
3897
  }
3861
- const keypress = ( (new ScanCodeBinding(
3862
- keyboardEvent.ctrlKey,
3863
- keyboardEvent.shiftKey,
3864
- keyboardEvent.altKey,
3865
- keyboardEvent.metaKey,
3866
- code
3867
- )));
3898
+ const ctrlKey = keyboardEvent.ctrlKey || (this._mapAltGrToCtrlAlt && keyboardEvent.altGraphKey);
3899
+ const altKey = keyboardEvent.altKey || (this._mapAltGrToCtrlAlt && keyboardEvent.altGraphKey);
3900
+ const chord = ( (new ScanCodeChord(ctrlKey, keyboardEvent.shiftKey, altKey, keyboardEvent.metaKey, code)));
3868
3901
  return (
3869
- (new NativeResolvedKeybinding(this, this._OS, [keypress]))
3902
+ (new NativeResolvedKeybinding(this, this._OS, [chord]))
3870
3903
  );
3871
3904
  }
3872
- _resolveSimpleUserBinding(binding) {
3873
- if (!binding) {
3905
+ _resolveChord(chord) {
3906
+ if (!chord) {
3874
3907
  return [];
3875
3908
  }
3876
- if (binding instanceof ScanCodeBinding) {
3877
- return [binding];
3909
+ if (chord instanceof ScanCodeChord) {
3910
+ return [chord];
3878
3911
  }
3879
- return this.simpleKeybindingToScanCodeBinding(binding);
3912
+ return this.keyCodeChordToScanCodeChord(chord);
3880
3913
  }
3881
- resolveUserBinding(input) {
3882
- const parts = input.map(keybinding => this._resolveSimpleUserBinding(keybinding));
3883
- return this._toResolvedKeybinding(parts);
3914
+ resolveKeybinding(keybinding) {
3915
+ const chords = keybinding.chords.map(chord => this._resolveChord(chord));
3916
+ return this._toResolvedKeybinding(chords);
3884
3917
  }
3885
3918
  static _redirectCharCode(charCode) {
3886
3919
  switch (charCode) {
@@ -3970,27 +4003,7 @@ function __variableDynamicImportRuntime0__(path) {
3970
4003
  })
3971
4004
  }
3972
4005
  }
3973
- class BrowserKeyboardMapperFactoryBase {
3974
- constructor(
3975
- ) {
3976
- this._onDidChangeKeyboardMapper = ( (new Emitter()));
3977
- this.onDidChangeKeyboardMapper = this._onDidChangeKeyboardMapper.event;
3978
- this._keyboardMapper = null;
3979
- this._initialized = false;
3980
- this._keymapInfos = [];
3981
- this._mru = [];
3982
- this._activeKeymapInfo = null;
3983
- if (navigator.keyboard && navigator.keyboard.addEventListener) {
3984
- navigator.keyboard.addEventListener('layoutchange', () => {
3985
- this._getBrowserKeyMapping().then((mapping) => {
3986
- if (this.isKeyMappingActive(mapping)) {
3987
- return;
3988
- }
3989
- this.setLayoutFromBrowserAPI();
3990
- });
3991
- });
3992
- }
3993
- }
4006
+ class BrowserKeyboardMapperFactoryBase extends Disposable {
3994
4007
  get activeKeymap() {
3995
4008
  return this._activeKeymapInfo;
3996
4009
  }
@@ -4001,17 +4014,44 @@ class BrowserKeyboardMapperFactoryBase {
4001
4014
  if (!this._initialized) {
4002
4015
  return null;
4003
4016
  }
4004
- return this._activeKeymapInfo && this._activeKeymapInfo.layout;
4017
+ return this._activeKeymapInfo?.layout ?? null;
4005
4018
  }
4006
4019
  get activeKeyMapping() {
4007
4020
  if (!this._initialized) {
4008
4021
  return null;
4009
4022
  }
4010
- return this._activeKeymapInfo && this._activeKeymapInfo.mapping;
4023
+ return this._activeKeymapInfo?.mapping ?? null;
4011
4024
  }
4012
4025
  get keyboardLayouts() {
4013
4026
  return this._keymapInfos.map(keymapInfo => keymapInfo.layout);
4014
4027
  }
4028
+ constructor(_configurationService) {
4029
+ super();
4030
+ this._configurationService = _configurationService;
4031
+ this._onDidChangeKeyboardMapper = ( (new Emitter()));
4032
+ this.onDidChangeKeyboardMapper = this._onDidChangeKeyboardMapper.event;
4033
+ this._keyboardMapper = null;
4034
+ this._initialized = false;
4035
+ this._keymapInfos = [];
4036
+ this._mru = [];
4037
+ this._activeKeymapInfo = null;
4038
+ if (navigator.keyboard && navigator.keyboard.addEventListener) {
4039
+ navigator.keyboard.addEventListener('layoutchange', () => {
4040
+ this._getBrowserKeyMapping().then((mapping) => {
4041
+ if (this.isKeyMappingActive(mapping)) {
4042
+ return;
4043
+ }
4044
+ this.setLayoutFromBrowserAPI();
4045
+ });
4046
+ });
4047
+ }
4048
+ this._register(this._configurationService.onDidChangeConfiguration((e) => {
4049
+ if (e.affectsConfiguration('keyboard')) {
4050
+ this._keyboardMapper = null;
4051
+ this._onDidChangeKeyboardMapper.fire();
4052
+ }
4053
+ }));
4054
+ }
4015
4055
  registerKeyboardLayout(layout) {
4016
4056
  this._keymapInfos.push(layout);
4017
4057
  this._mru = this._keymapInfos;
@@ -4128,16 +4168,17 @@ class BrowserKeyboardMapperFactoryBase {
4128
4168
  this.setActiveKeyMapping(keyMap);
4129
4169
  });
4130
4170
  }
4131
- getKeyboardMapper(dispatchConfig) {
4132
- if (!this._initialized) {
4171
+ getKeyboardMapper() {
4172
+ const config = readKeyboardConfig(this._configurationService);
4173
+ if (config.dispatch === 1 || !this._initialized || !this._activeKeymapInfo) {
4133
4174
  return (
4134
- (new MacLinuxFallbackKeyboardMapper(OS))
4175
+ (new FallbackKeyboardMapper(config.mapAltGrToCtrlAlt, OS))
4135
4176
  );
4136
4177
  }
4137
- if (dispatchConfig === 1 ) {
4138
- return (
4139
- (new MacLinuxFallbackKeyboardMapper(OS))
4140
- );
4178
+ if (!this._keyboardMapper) {
4179
+ this._keyboardMapper = ( (new CachedKeyboardMapper(
4180
+ BrowserKeyboardMapperFactory._createKeyboardMapper(this._activeKeymapInfo, config.mapAltGrToCtrlAlt)
4181
+ )));
4141
4182
  }
4142
4183
  return this._keyboardMapper;
4143
4184
  }
@@ -4159,24 +4200,24 @@ class BrowserKeyboardMapperFactoryBase {
4159
4200
  }
4160
4201
  _setKeyboardData(keymapInfo) {
4161
4202
  this._initialized = true;
4162
- this._keyboardMapper = ( (new CachedKeyboardMapper(BrowserKeyboardMapperFactory._createKeyboardMapper(keymapInfo))));
4203
+ this._keyboardMapper = null;
4163
4204
  this._onDidChangeKeyboardMapper.fire();
4164
4205
  }
4165
- static _createKeyboardMapper(keymapInfo) {
4206
+ static _createKeyboardMapper(keymapInfo, mapAltGrToCtrlAlt) {
4166
4207
  const rawMapping = keymapInfo.mapping;
4167
4208
  const isUSStandard = !!keymapInfo.layout.isUSStandard;
4168
4209
  if (OS === 1 ) {
4169
4210
  return (
4170
- (new WindowsKeyboardMapper(isUSStandard, rawMapping))
4211
+ (new WindowsKeyboardMapper(isUSStandard, rawMapping, mapAltGrToCtrlAlt))
4171
4212
  );
4172
4213
  }
4173
4214
  if (( (Object.keys(rawMapping))).length === 0) {
4174
4215
  return (
4175
- (new MacLinuxFallbackKeyboardMapper(OS))
4216
+ (new FallbackKeyboardMapper(mapAltGrToCtrlAlt, OS))
4176
4217
  );
4177
4218
  }
4178
4219
  return (
4179
- (new MacLinuxKeyboardMapper(isUSStandard, rawMapping, OS))
4220
+ (new MacLinuxKeyboardMapper(isUSStandard, rawMapping, mapAltGrToCtrlAlt, OS))
4180
4221
  );
4181
4222
  }
4182
4223
  _validateCurrentKeyboardMapping(keyboardEvent) {
@@ -4261,8 +4302,8 @@ class BrowserKeyboardMapperFactoryBase {
4261
4302
  }
4262
4303
  }
4263
4304
  class BrowserKeyboardMapperFactory extends BrowserKeyboardMapperFactoryBase {
4264
- constructor(notificationService, storageService, commandService) {
4265
- super();
4305
+ constructor(configurationService, notificationService, storageService, commandService) {
4306
+ super(configurationService);
4266
4307
  const platform = isWindows ? 'win' : isMacintosh ? 'darwin' : 'linux';
4267
4308
  __variableDynamicImportRuntime0__('./keyboardLayouts/layout.contribution.' + platform + '.js').then((m) => {
4268
4309
  const keymapInfos = m.KeyboardLayoutContribution.INSTANCE.layoutInfos;
@@ -4279,6 +4320,7 @@ class BrowserKeyboardMapperFactory extends BrowserKeyboardMapperFactoryBase {
4279
4320
  }
4280
4321
  }
4281
4322
  class UserKeyboardLayout extends Disposable {
4323
+ get keyboardLayout() { return this._keyboardLayout; }
4282
4324
  constructor(keyboardLayoutResource, fileService) {
4283
4325
  super();
4284
4326
  this.keyboardLayoutResource = keyboardLayoutResource;
@@ -4293,7 +4335,6 @@ class UserKeyboardLayout extends Disposable {
4293
4335
  }), 50))));
4294
4336
  this._register(Event.filter(this.fileService.onDidFilesChange, e => e.contains(this.keyboardLayoutResource))(() => this.reloadConfigurationScheduler.schedule()));
4295
4337
  }
4296
- get keyboardLayout() { return this._keyboardLayout; }
4297
4338
  async initialize() {
4298
4339
  await this.reload();
4299
4340
  }
@@ -4326,7 +4367,7 @@ let BrowserKeyboardLayoutService = class BrowserKeyboardLayoutService extends Di
4326
4367
  const keyboardConfig = configurationService.getValue('keyboard');
4327
4368
  const layout = keyboardConfig.layout;
4328
4369
  this._keyboardLayoutMode = layout ?? 'autodetect';
4329
- this._factory = ( (new BrowserKeyboardMapperFactory(notificationService, storageService, commandService)));
4370
+ this._factory = ( (new BrowserKeyboardMapperFactory(configurationService, notificationService, storageService, commandService)));
4330
4371
  this._register(this._factory.onDidChangeKeyboardMapper(() => {
4331
4372
  this._onDidChangeKeyboardLayout.fire();
4332
4373
  }));
@@ -4334,7 +4375,7 @@ let BrowserKeyboardLayoutService = class BrowserKeyboardLayoutService extends Di
4334
4375
  this._factory.setKeyboardLayout(layout);
4335
4376
  }
4336
4377
  this._register(configurationService.onDidChangeConfiguration(e => {
4337
- if (e.affectedKeys.indexOf('keyboard.layout') >= 0) {
4378
+ if (e.affectsConfiguration('keyboard.layout')) {
4338
4379
  const keyboardConfig = configurationService.getValue('keyboard');
4339
4380
  const layout = keyboardConfig.layout;
4340
4381
  this._keyboardLayoutMode = layout;
@@ -4382,8 +4423,8 @@ let BrowserKeyboardLayoutService = class BrowserKeyboardLayoutService extends Di
4382
4423
  }
4383
4424
  }
4384
4425
  }
4385
- getKeyboardMapper(dispatchConfig) {
4386
- return this._factory.getKeyboardMapper(dispatchConfig);
4426
+ getKeyboardMapper() {
4427
+ return this._factory.getKeyboardMapper();
4387
4428
  }
4388
4429
  getCurrentKeyboardLayout() {
4389
4430
  return this._factory.activeKeyboardLayout;
@@ -4453,14 +4494,43 @@ const provider = quickAccessRegistry.getQuickAccessProviders().find(provider =>
4453
4494
  if (provider != null) {
4454
4495
  provider.ctor = class extends CommandsQuickAccessProvider {
4455
4496
  get defaultFilterValue() { return undefined; }
4456
- async getCommandPicks(disposables, token) {
4457
- return (await super.getCommandPicks(disposables, token)).map(pick => {
4497
+ async getCommandPicks(token) {
4498
+ return (await super.getCommandPicks(token)).map(pick => {
4458
4499
  pick.buttons = [];
4459
4500
  return pick;
4460
4501
  });
4461
4502
  }
4462
4503
  };
4463
4504
  }
4505
+ configurationRegistry$2.registerConfiguration({
4506
+ properties: {
4507
+ 'workbench.commandPalette.history': {
4508
+ type: 'number',
4509
+ description: ( localize(
4510
+ 'commandHistory',
4511
+ 'Controls the number of recently used commands to keep in history for the command palette. Set to 0 to disable command history.'
4512
+ )),
4513
+ default: 50,
4514
+ minimum: 0
4515
+ },
4516
+ 'workbench.commandPalette.preserveInput': {
4517
+ type: 'boolean',
4518
+ description: ( localize(
4519
+ 'preserveInput',
4520
+ 'Controls whether the last typed input to the command palette should be restored when opening it the next time.'
4521
+ )),
4522
+ default: false
4523
+ },
4524
+ 'workbench.commandPalette.experimental.suggestCommands': {
4525
+ type: 'boolean',
4526
+ description: ( localize(
4527
+ 'suggestCommands',
4528
+ 'Controls whether the command palette should have a list of commonly used commands.'
4529
+ )),
4530
+ default: false
4531
+ }
4532
+ }
4533
+ });
4464
4534
  const keybindingsExtensionPoint = getExtensionPoint('keybindings');
4465
4535
  const commandsExtensionPoint = getExtensionPoint('commands');
4466
4536
  function setKeybindings(grammars, extension = Services.get().extension ?? DEFAULT_EXTENSION) {
@@ -4484,6 +4554,7 @@ async function updateUserKeybindings(keybindingsJson) {
4484
4554
  function getServiceOverride() {
4485
4555
  return {
4486
4556
  ...getServiceOverride$1(),
4557
+ ...getServiceOverride$2(),
4487
4558
  [( IKeybindingService.toString())]: new SyncDescriptor(DelegateStandaloneKeybindingService),
4488
4559
  [( IKeyboardLayoutService.toString())]: new SyncDescriptor(BrowserKeyboardLayoutService)
4489
4560
  };