@codingame/monaco-vscode-keybindings-service-override 23.2.2 → 24.1.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.
Files changed (19) hide show
  1. package/index.d.ts +9 -2
  2. package/index.js +21 -15
  3. package/package.json +3 -8
  4. package/vscode/src/vs/platform/keyboardLayout/common/keyboardConfig.js +3 -3
  5. package/vscode/src/vs/workbench/contrib/commands/common/commands.contribution.js +5 -5
  6. package/vscode/src/vs/workbench/contrib/keybindings/browser/keybindings.contribution.js +1 -1
  7. package/vscode/src/vs/workbench/contrib/preferences/browser/keybindingsEditorContribution.js +6 -6
  8. package/vscode/src/vs/workbench/services/actions/common/menusExtensionPoint.js +156 -144
  9. package/vscode/src/vs/workbench/services/keybinding/browser/keybindingService.d.ts +1 -0
  10. package/vscode/src/vs/workbench/services/keybinding/browser/keybindingService.js +36 -33
  11. package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayoutService.d.ts +1 -1
  12. package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayoutService.js +3 -3
  13. package/vscode/src/vs/workbench/services/keybinding/common/keybindingIO.d.ts +1 -1
  14. package/vscode/src/vs/workbench/services/keybinding/common/keybindingIO.js +1 -1
  15. package/vscode/src/vs/workbench/services/keybinding/common/keymapInfo.d.ts +1 -1
  16. package/vscode/src/vs/workbench/services/keybinding/common/keymapInfo.js +1 -1
  17. package/vscode/src/vs/workbench/services/keybinding/common/macLinuxKeyboardMapper.d.ts +1 -1
  18. package/vscode/src/vs/workbench/services/keybinding/common/macLinuxKeyboardMapper.js +2 -2
  19. package/vscode/src/vs/workbench/services/keybinding/common/windowsKeyboardMapper.d.ts +1 -1
@@ -26,6 +26,7 @@ export declare class WorkbenchKeybindingService extends AbstractKeybindingServic
26
26
  private readonly _contributions;
27
27
  private readonly kbsJsonSchema;
28
28
  constructor(contextKeyService: IContextKeyService, commandService: ICommandService, telemetryService: ITelemetryService, notificationService: INotificationService, userDataProfileService: IUserDataProfileService, hostService: IHostService, extensionService: IExtensionService, fileService: IFileService, uriIdentityService: IUriIdentityService, logService: ILogService, keyboardLayoutService: IKeyboardLayoutService);
29
+ protected lockKeyCodes(keyCodes: string[]): void;
29
30
  dispose(): void;
30
31
  private _registerKeyListeners;
31
32
  registerSchemaContribution(contribution: KeybindingsSchemaContribution): IDisposable;
@@ -10,7 +10,7 @@ import { DeferredPromise, RunOnceScheduler } from '@codingame/monaco-vscode-api/
10
10
  import { Event, Emitter } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
11
11
  import { parse } from '@codingame/monaco-vscode-api/vscode/vs/base/common/json';
12
12
  import { UserSettingsLabelProvider } from '@codingame/monaco-vscode-api/vscode/vs/base/common/keybindingLabels';
13
- import { KeybindingParser } from '@codingame/monaco-vscode-2a22c7b4-b906-5914-8cd1-3ed912fb738f-common/vscode/vs/base/common/keybindingParser';
13
+ import { KeybindingParser } from '@codingame/monaco-vscode-api/vscode/vs/base/common/keybindingParser';
14
14
  import { KeyCodeChord, ScanCodeChord } from '@codingame/monaco-vscode-api/vscode/vs/base/common/keybindings';
15
15
  import { ScanCode, KeyCode, KeyCodeUtils, ScanCodeUtils, KeyMod, IMMUTABLE_CODE_TO_KEY_CODE } from '@codingame/monaco-vscode-api/vscode/vs/base/common/keyCodes';
16
16
  import { DisposableStore, toDisposable, Disposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
@@ -45,44 +45,44 @@ import { ExtensionsRegistry } from '@codingame/monaco-vscode-api/vscode/vs/workb
45
45
  import { IHostService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/host/browser/host.service';
46
46
  import { IUserDataProfileService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/userDataProfile/common/userDataProfile.service';
47
47
  import { OutputBuilder, KeybindingIO } from '../common/keybindingIO.js';
48
- import { getAllUnboundCommands } from '@codingame/monaco-vscode-d609a7d3-bf87-551a-884f-550a8b327ec5-common/vscode/vs/workbench/services/keybinding/browser/unboundCommands';
48
+ import { getAllUnboundCommands } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/keybinding/browser/unboundCommands';
49
49
 
50
50
  var WorkbenchKeybindingService_1;
51
51
  function isValidContributedKeyBinding(keyBinding, rejects) {
52
52
  if (!keyBinding) {
53
- rejects.push(( localize(13919, "expected non-empty value.")));
53
+ rejects.push(( localize(14060, "expected non-empty value.")));
54
54
  return false;
55
55
  }
56
56
  if (typeof keyBinding.command !== 'string') {
57
57
  rejects.push(( localize(
58
- 13920,
58
+ 14061,
59
59
  "property `{0}` is mandatory and must be of type `string`",
60
60
  'command'
61
61
  )));
62
62
  return false;
63
63
  }
64
64
  if (keyBinding.key && typeof keyBinding.key !== 'string') {
65
- rejects.push(( localize(13921, "property `{0}` can be omitted or must be of type `string`", 'key')));
65
+ rejects.push(( localize(14062, "property `{0}` can be omitted or must be of type `string`", 'key')));
66
66
  return false;
67
67
  }
68
68
  if (keyBinding.when && typeof keyBinding.when !== 'string') {
69
- rejects.push(( localize(13921, "property `{0}` can be omitted or must be of type `string`", 'when')));
69
+ rejects.push(( localize(14062, "property `{0}` can be omitted or must be of type `string`", 'when')));
70
70
  return false;
71
71
  }
72
72
  if (keyBinding.mac && typeof keyBinding.mac !== 'string') {
73
- rejects.push(( localize(13921, "property `{0}` can be omitted or must be of type `string`", 'mac')));
73
+ rejects.push(( localize(14062, "property `{0}` can be omitted or must be of type `string`", 'mac')));
74
74
  return false;
75
75
  }
76
76
  if (keyBinding.linux && typeof keyBinding.linux !== 'string') {
77
77
  rejects.push(( localize(
78
- 13921,
78
+ 14062,
79
79
  "property `{0}` can be omitted or must be of type `string`",
80
80
  'linux'
81
81
  )));
82
82
  return false;
83
83
  }
84
84
  if (keyBinding.win && typeof keyBinding.win !== 'string') {
85
- rejects.push(( localize(13921, "property `{0}` can be omitted or must be of type `string`", 'win')));
85
+ rejects.push(( localize(14062, "property `{0}` can be omitted or must be of type `string`", 'win')));
86
86
  return false;
87
87
  }
88
88
  return true;
@@ -93,33 +93,33 @@ const keybindingType = {
93
93
  required: ['command', 'key'],
94
94
  properties: {
95
95
  command: {
96
- description: ( localize(13922, 'Identifier of the command to run when keybinding is triggered.')),
96
+ description: ( localize(14063, 'Identifier of the command to run when keybinding is triggered.')),
97
97
  type: 'string'
98
98
  },
99
99
  args: {
100
- description: ( localize(13923, "Arguments to pass to the command to execute."))
100
+ description: ( localize(14064, "Arguments to pass to the command to execute."))
101
101
  },
102
102
  key: {
103
103
  description: ( localize(
104
- 13924,
104
+ 14065,
105
105
  'Key or key sequence (separate keys with plus-sign and sequences with space, e.g. Ctrl+O and Ctrl+L L for a chord).'
106
106
  )),
107
107
  type: 'string'
108
108
  },
109
109
  mac: {
110
- description: ( localize(13925, 'Mac specific key or key sequence.')),
110
+ description: ( localize(14066, 'Mac specific key or key sequence.')),
111
111
  type: 'string'
112
112
  },
113
113
  linux: {
114
- description: ( localize(13926, 'Linux specific key or key sequence.')),
114
+ description: ( localize(14067, 'Linux specific key or key sequence.')),
115
115
  type: 'string'
116
116
  },
117
117
  win: {
118
- description: ( localize(13927, 'Windows specific key or key sequence.')),
118
+ description: ( localize(14068, 'Windows specific key or key sequence.')),
119
119
  type: 'string'
120
120
  },
121
121
  when: {
122
- description: ( localize(13928, 'Condition when the key is active.')),
122
+ description: ( localize(14069, 'Condition when the key is active.')),
123
123
  type: 'string'
124
124
  },
125
125
  }
@@ -128,7 +128,7 @@ const keybindingsExtPoint = ExtensionsRegistry.registerExtensionPoint({
128
128
  extensionPoint: 'keybindings',
129
129
  deps: [commandsExtensionPoint],
130
130
  jsonSchema: {
131
- description: ( localize(13929, "Contributes keybindings.")),
131
+ description: ( localize(14070, "Contributes keybindings.")),
132
132
  oneOf: [
133
133
  keybindingType,
134
134
  {
@@ -207,20 +207,23 @@ let WorkbenchKeybindingService = WorkbenchKeybindingService_1 = class WorkbenchK
207
207
  if (windowId !== mainWindow.vscodeWindowId) {
208
208
  return;
209
209
  }
210
- const keyboard = navigator.keyboard;
211
210
  if (BrowserFeatures.keyboard === KeyboardSupport.None) {
212
211
  return;
213
212
  }
214
- if (isFullscreen(mainWindow)) {
215
- keyboard?.lock(['Escape']);
216
- }
217
- else {
218
- keyboard?.unlock();
219
- }
213
+ this.lockKeyCodes(isFullscreen(mainWindow) ? ['Escape'] : []);
220
214
  this._cachedResolver = null;
221
215
  this._onDidUpdateKeybindings.fire();
222
216
  }));
223
217
  }
218
+ lockKeyCodes(keyCodes) {
219
+ const keyboard = mainWindow.navigator.keyboard;
220
+ if (keyCodes.length > 0) {
221
+ keyboard?.lock(keyCodes);
222
+ }
223
+ else {
224
+ keyboard?.unlock();
225
+ }
226
+ }
224
227
  dispose() {
225
228
  this._contributions.forEach(c => c.listener?.dispose());
226
229
  this._contributions.length = 0;
@@ -516,7 +519,7 @@ let WorkbenchKeybindingService = WorkbenchKeybindingService_1 = class WorkbenchK
516
519
  }
517
520
  if (rejects.length > 0) {
518
521
  collector.error(( localize(
519
- 13930,
522
+ 14071,
520
523
  "Invalid `contributes.{0}`: {1}",
521
524
  keybindingsExtPoint.name,
522
525
  rejects.join('\n')
@@ -604,7 +607,7 @@ let WorkbenchKeybindingService = WorkbenchKeybindingService_1 = class WorkbenchK
604
607
  static _getAllCommandsAsComment(boundCommands) {
605
608
  const unboundCommands = getAllUnboundCommands(boundCommands);
606
609
  const pretty = unboundCommands.sort().join('\n// - ');
607
- return '// ' + ( localize(13931, "Here are other available commands: ")) + '\n// - ' + pretty;
610
+ return '// ' + ( localize(14072, "Here are other available commands: ")) + '\n// - ' + pretty;
608
611
  }
609
612
  mightProducePrintableCharacter(event) {
610
613
  if (event.ctrlKey || event.metaKey || event.altKey) {
@@ -729,7 +732,7 @@ class KeybindingsJsonSchema {
729
732
  this.schema = {
730
733
  id: KeybindingsJsonSchema.schemaId,
731
734
  type: 'array',
732
- title: ( localize(13932, "Keybindings configuration")),
735
+ title: ( localize(14073, "Keybindings configuration")),
733
736
  allowTrailingCommas: true,
734
737
  allowComments: true,
735
738
  definitions: {
@@ -753,7 +756,7 @@ class KeybindingsJsonSchema {
753
756
  'type': 'string',
754
757
  'enum': this.commandsEnum,
755
758
  'enumDescriptions': this.commandsEnumDescriptions,
756
- 'description': ( localize(13933, "Name of the command to execute")),
759
+ 'description': ( localize(14074, "Name of the command to execute")),
757
760
  },
758
761
  'commandType': {
759
762
  'anyOf': [
@@ -764,7 +767,7 @@ class KeybindingsJsonSchema {
764
767
  'type': 'string',
765
768
  'enum': this.removalCommandsEnum,
766
769
  'enumDescriptions': this.commandsEnumDescriptions,
767
- 'description': ( localize(13934, "Name of the command to remove keyboard shortcut for")),
770
+ 'description': ( localize(14075, "Name of the command to remove keyboard shortcut for")),
768
771
  },
769
772
  {
770
773
  'type': 'string'
@@ -782,7 +785,7 @@ class KeybindingsJsonSchema {
782
785
  'properties': {
783
786
  'key': {
784
787
  'type': 'string',
785
- 'description': ( localize(13935, "Key or key sequence (separated by space)")),
788
+ 'description': ( localize(14076, "Key or key sequence (separated by space)")),
786
789
  },
787
790
  'command': {
788
791
  'anyOf': [
@@ -795,7 +798,7 @@ class KeybindingsJsonSchema {
795
798
  'type': 'array'
796
799
  },
797
800
  'errorMessage': ( localize(
798
- 13936,
801
+ 14077,
799
802
  "Incorrect type. Expected \"{0}\". The field 'command' does not support running multiple commands. Use command 'runCommands' to pass it multiple commands to run.",
800
803
  'string'
801
804
  ))
@@ -811,10 +814,10 @@ class KeybindingsJsonSchema {
811
814
  },
812
815
  'when': {
813
816
  'type': 'string',
814
- 'description': ( localize(13937, "Condition when the key is active."))
817
+ 'description': ( localize(14078, "Condition when the key is active."))
815
818
  },
816
819
  'args': {
817
- 'description': ( localize(13938, "Arguments to pass to the command to execute."))
820
+ 'description': ( localize(14079, "Arguments to pass to the command to execute."))
818
821
  }
819
822
  },
820
823
  '$ref': '#/definitions/commandsSchemas'
@@ -9,7 +9,7 @@ import { IConfigurationService } from "@codingame/monaco-vscode-api/vscode/vs/pl
9
9
  import { INotificationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/notification/common/notification.service";
10
10
  import { ICommandService } from "@codingame/monaco-vscode-api/vscode/vs/platform/commands/common/commands.service";
11
11
  import { IStorageService } from "@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage.service";
12
- import { IKeyboardLayoutInfo, IKeyboardMapping } from "@codingame/monaco-vscode-40cada32-7e9c-528a-81fc-766e4da54147-common/vscode/vs/platform/keyboardLayout/common/keyboardLayout";
12
+ import { IKeyboardLayoutInfo, IKeyboardMapping } from "@codingame/monaco-vscode-api/vscode/vs/platform/keyboardLayout/common/keyboardLayout";
13
13
  import { IKeyboardLayoutService } from "@codingame/monaco-vscode-api/vscode/vs/platform/keyboardLayout/common/keyboardLayout.service";
14
14
  export declare class BrowserKeyboardMapperFactoryBase extends Disposable {
15
15
  private readonly _configurationService;
@@ -22,7 +22,7 @@ import { IConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/pl
22
22
  import { INotificationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/notification/common/notification.service';
23
23
  import { ICommandService } from '@codingame/monaco-vscode-api/vscode/vs/platform/commands/common/commands.service';
24
24
  import { IStorageService } from '@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage.service';
25
- import { getKeyboardLayoutId } from '@codingame/monaco-vscode-40cada32-7e9c-528a-81fc-766e4da54147-common/vscode/vs/platform/keyboardLayout/common/keyboardLayout';
25
+ import { getKeyboardLayoutId } from '@codingame/monaco-vscode-api/vscode/vs/platform/keyboardLayout/common/keyboardLayout';
26
26
  import '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
27
27
 
28
28
  function __variableDynamicImportRuntime0__(path) {
@@ -483,12 +483,12 @@ const keyboardConfiguration = {
483
483
  'id': 'keyboard',
484
484
  'order': 15,
485
485
  'type': 'object',
486
- 'title': ( localize(13939, "Keyboard")),
486
+ 'title': ( localize(14080, "Keyboard")),
487
487
  'properties': {
488
488
  'keyboard.layout': {
489
489
  'type': 'string',
490
490
  'default': 'autodetect',
491
- 'description': ( localize(13940, "Control the keyboard layout used in web."))
491
+ 'description': ( localize(14081, "Control the keyboard layout used in web."))
492
492
  }
493
493
  }
494
494
  };
@@ -4,7 +4,7 @@ import { ResolvedKeybindingItem } from "@codingame/monaco-vscode-api/vscode/vs/p
4
4
  export interface IUserKeybindingItem {
5
5
  keybinding: Keybinding | null;
6
6
  command: string | null;
7
- commandArgs?: any;
7
+ commandArgs?: unknown;
8
8
  when: ContextKeyExpression | undefined;
9
9
  _sourceKey: string | undefined; /** captures `key` field from `keybindings.json`; `this.keybinding !== null` implies `_sourceKey !== null` */
10
10
  }
@@ -1,5 +1,5 @@
1
1
 
2
- import { KeybindingParser } from '@codingame/monaco-vscode-2a22c7b4-b906-5914-8cd1-3ed912fb738f-common/vscode/vs/base/common/keybindingParser';
2
+ import { KeybindingParser } from '@codingame/monaco-vscode-api/vscode/vs/base/common/keybindingParser';
3
3
  import { ContextKeyExpr } from '@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey';
4
4
 
5
5
  class KeybindingIO {
@@ -1,4 +1,4 @@
1
- import { IKeyboardLayoutInfo } from "@codingame/monaco-vscode-40cada32-7e9c-528a-81fc-766e4da54147-common/vscode/vs/platform/keyboardLayout/common/keyboardLayout";
1
+ import { IKeyboardLayoutInfo } from "@codingame/monaco-vscode-api/vscode/vs/platform/keyboardLayout/common/keyboardLayout";
2
2
  export interface IRawMixedKeyboardMapping {
3
3
  [key: string]: {
4
4
  value: string;
@@ -1,6 +1,6 @@
1
1
 
2
2
  import { isWindows, isLinux } from '@codingame/monaco-vscode-api/vscode/vs/base/common/platform';
3
- import { getKeyboardLayoutId } from '@codingame/monaco-vscode-40cada32-7e9c-528a-81fc-766e4da54147-common/vscode/vs/platform/keyboardLayout/common/keyboardLayout';
3
+ import { getKeyboardLayoutId } from '@codingame/monaco-vscode-api/vscode/vs/platform/keyboardLayout/common/keyboardLayout';
4
4
 
5
5
  function deserializeMapping(serializedMapping) {
6
6
  const mapping = serializedMapping;
@@ -3,7 +3,7 @@ import { OperatingSystem } from "@codingame/monaco-vscode-api/vscode/vs/base/com
3
3
  import { IKeyboardEvent } from "@codingame/monaco-vscode-api/vscode/vs/platform/keybinding/common/keybinding";
4
4
  import { IKeyboardMapper } from "../../../../platform/keyboardLayout/common/keyboardMapper.js";
5
5
  import { BaseResolvedKeybinding } from "@codingame/monaco-vscode-api/vscode/vs/platform/keybinding/common/baseResolvedKeybinding";
6
- import { IMacLinuxKeyboardMapping } from "@codingame/monaco-vscode-40cada32-7e9c-528a-81fc-766e4da54147-common/vscode/vs/platform/keyboardLayout/common/keyboardLayout";
6
+ import { IMacLinuxKeyboardMapping } from "@codingame/monaco-vscode-api/vscode/vs/platform/keyboardLayout/common/keyboardLayout";
7
7
  export declare class NativeResolvedKeybinding extends BaseResolvedKeybinding<ScanCodeChord> {
8
8
  private readonly _mapper;
9
9
  constructor(mapper: MacLinuxKeyboardMapper, os: OperatingSystem, chords: ScanCodeChord[]);
@@ -1,6 +1,6 @@
1
1
 
2
2
  import { CharCode } from '@codingame/monaco-vscode-api/vscode/vs/base/common/charCode';
3
- import { IMMUTABLE_CODE_TO_KEY_CODE, KeyCode, ScanCode, ScanCodeUtils, KeyCodeUtils, IMMUTABLE_KEY_CODE_TO_CODE } from '@codingame/monaco-vscode-api/vscode/vs/base/common/keyCodes';
3
+ import { IMMUTABLE_CODE_TO_KEY_CODE, KeyCode, ScanCode, ScanCodeUtils, KeyCodeUtils, isModifierKey, IMMUTABLE_KEY_CODE_TO_CODE } from '@codingame/monaco-vscode-api/vscode/vs/base/common/keyCodes';
4
4
  import { ScanCodeChord, KeyCodeChord } from '@codingame/monaco-vscode-api/vscode/vs/base/common/keybindings';
5
5
  import { OperatingSystem } from '@codingame/monaco-vscode-api/vscode/vs/base/common/platform';
6
6
  import { BaseResolvedKeybinding } from '@codingame/monaco-vscode-api/vscode/vs/platform/keybinding/common/baseResolvedKeybinding';
@@ -294,7 +294,7 @@ class MacLinuxKeyboardMapper {
294
294
  if (keyCode !== KeyCode.DependsOnKbLayout) {
295
295
  _registerAllCombos(0, 0, 0, scanCode, keyCode);
296
296
  this._scanCodeToLabel[scanCode] = ( KeyCodeUtils.toString(keyCode));
297
- if (keyCode === KeyCode.Unknown || keyCode === KeyCode.Ctrl || keyCode === KeyCode.Meta || keyCode === KeyCode.Alt || keyCode === KeyCode.Shift) {
297
+ if (keyCode === KeyCode.Unknown || isModifierKey(keyCode)) {
298
298
  this._scanCodeToDispatch[scanCode] = null;
299
299
  }
300
300
  else {
@@ -3,7 +3,7 @@ import { ResolvedKeybinding, KeyCodeChord, SingleModifierChord, ScanCodeChord, K
3
3
  import { IKeyboardEvent } from "@codingame/monaco-vscode-api/vscode/vs/platform/keybinding/common/keybinding";
4
4
  import { IKeyboardMapper } from "../../../../platform/keyboardLayout/common/keyboardMapper.js";
5
5
  import { BaseResolvedKeybinding } from "@codingame/monaco-vscode-api/vscode/vs/platform/keybinding/common/baseResolvedKeybinding";
6
- import { IWindowsKeyboardMapping } from "@codingame/monaco-vscode-40cada32-7e9c-528a-81fc-766e4da54147-common/vscode/vs/platform/keyboardLayout/common/keyboardLayout";
6
+ import { IWindowsKeyboardMapping } from "@codingame/monaco-vscode-api/vscode/vs/platform/keyboardLayout/common/keyboardLayout";
7
7
  export interface IScanCodeMapping {
8
8
  scanCode: ScanCode;
9
9
  keyCode: KeyCode;