@codingame/monaco-vscode-keybindings-service-override 4.5.0 → 4.5.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.
- package/index.d.ts +2 -2
- package/package.json +3 -3
- package/vscode/src/vs/platform/keyboardLayout/common/keyboardConfig.js +7 -10
- package/vscode/src/vs/workbench/contrib/commands/common/commands.contribution.js +8 -19
- package/vscode/src/vs/workbench/contrib/keybindings/browser/keybindings.contribution.js +2 -5
- package/vscode/src/vs/workbench/contrib/preferences/browser/keybindingsEditorContribution.js +21 -37
- package/vscode/src/vs/workbench/services/actions/common/menusExtensionPoint.js +200 -569
- package/vscode/src/vs/workbench/services/keybinding/browser/keybindingService.js +89 -138
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayoutService.js +40 -37
- package/keybindings.d.ts +0 -19
|
@@ -44,19 +44,16 @@ import { OutputBuilder, KeybindingIO } from '../common/keybindingIO.js';
|
|
|
44
44
|
import { IUserDataProfileService } from 'vscode/vscode/vs/workbench/services/userDataProfile/common/userDataProfile.service';
|
|
45
45
|
|
|
46
46
|
var WorkbenchKeybindingService_1;
|
|
47
|
+
const _moduleId = "vs/workbench/services/keybinding/browser/keybindingService";
|
|
47
48
|
function isValidContributedKeyBinding(keyBinding, rejects) {
|
|
48
49
|
if (!keyBinding) {
|
|
49
|
-
rejects.push(( localizeWithPath(
|
|
50
|
-
'vs/workbench/services/keybinding/browser/keybindingService',
|
|
51
|
-
'nonempty',
|
|
52
|
-
"expected non-empty value."
|
|
53
|
-
)));
|
|
50
|
+
rejects.push(( localizeWithPath(_moduleId, 0, "expected non-empty value.")));
|
|
54
51
|
return false;
|
|
55
52
|
}
|
|
56
53
|
if (typeof keyBinding.command !== 'string') {
|
|
57
54
|
rejects.push(( localizeWithPath(
|
|
58
|
-
|
|
59
|
-
|
|
55
|
+
_moduleId,
|
|
56
|
+
1,
|
|
60
57
|
"property `{0}` is mandatory and must be of type `string`",
|
|
61
58
|
'command'
|
|
62
59
|
)));
|
|
@@ -64,8 +61,8 @@ function isValidContributedKeyBinding(keyBinding, rejects) {
|
|
|
64
61
|
}
|
|
65
62
|
if (keyBinding.key && typeof keyBinding.key !== 'string') {
|
|
66
63
|
rejects.push(( localizeWithPath(
|
|
67
|
-
|
|
68
|
-
|
|
64
|
+
_moduleId,
|
|
65
|
+
2,
|
|
69
66
|
"property `{0}` can be omitted or must be of type `string`",
|
|
70
67
|
'key'
|
|
71
68
|
)));
|
|
@@ -73,8 +70,8 @@ function isValidContributedKeyBinding(keyBinding, rejects) {
|
|
|
73
70
|
}
|
|
74
71
|
if (keyBinding.when && typeof keyBinding.when !== 'string') {
|
|
75
72
|
rejects.push(( localizeWithPath(
|
|
76
|
-
|
|
77
|
-
|
|
73
|
+
_moduleId,
|
|
74
|
+
2,
|
|
78
75
|
"property `{0}` can be omitted or must be of type `string`",
|
|
79
76
|
'when'
|
|
80
77
|
)));
|
|
@@ -82,8 +79,8 @@ function isValidContributedKeyBinding(keyBinding, rejects) {
|
|
|
82
79
|
}
|
|
83
80
|
if (keyBinding.mac && typeof keyBinding.mac !== 'string') {
|
|
84
81
|
rejects.push(( localizeWithPath(
|
|
85
|
-
|
|
86
|
-
|
|
82
|
+
_moduleId,
|
|
83
|
+
2,
|
|
87
84
|
"property `{0}` can be omitted or must be of type `string`",
|
|
88
85
|
'mac'
|
|
89
86
|
)));
|
|
@@ -91,8 +88,8 @@ function isValidContributedKeyBinding(keyBinding, rejects) {
|
|
|
91
88
|
}
|
|
92
89
|
if (keyBinding.linux && typeof keyBinding.linux !== 'string') {
|
|
93
90
|
rejects.push(( localizeWithPath(
|
|
94
|
-
|
|
95
|
-
|
|
91
|
+
_moduleId,
|
|
92
|
+
2,
|
|
96
93
|
"property `{0}` can be omitted or must be of type `string`",
|
|
97
94
|
'linux'
|
|
98
95
|
)));
|
|
@@ -100,8 +97,8 @@ function isValidContributedKeyBinding(keyBinding, rejects) {
|
|
|
100
97
|
}
|
|
101
98
|
if (keyBinding.win && typeof keyBinding.win !== 'string') {
|
|
102
99
|
rejects.push(( localizeWithPath(
|
|
103
|
-
|
|
104
|
-
|
|
100
|
+
_moduleId,
|
|
101
|
+
2,
|
|
105
102
|
"property `{0}` can be omitted or must be of type `string`",
|
|
106
103
|
'win'
|
|
107
104
|
)));
|
|
@@ -115,57 +112,37 @@ const keybindingType = {
|
|
|
115
112
|
properties: {
|
|
116
113
|
command: {
|
|
117
114
|
description: ( localizeWithPath(
|
|
118
|
-
|
|
119
|
-
|
|
115
|
+
_moduleId,
|
|
116
|
+
3,
|
|
120
117
|
'Identifier of the command to run when keybinding is triggered.'
|
|
121
118
|
)),
|
|
122
119
|
type: 'string'
|
|
123
120
|
},
|
|
124
121
|
args: {
|
|
125
|
-
description: ( localizeWithPath(
|
|
126
|
-
'vs/workbench/services/keybinding/browser/keybindingService',
|
|
127
|
-
'vscode.extension.contributes.keybindings.args',
|
|
128
|
-
"Arguments to pass to the command to execute."
|
|
129
|
-
))
|
|
122
|
+
description: ( localizeWithPath(_moduleId, 4, "Arguments to pass to the command to execute."))
|
|
130
123
|
},
|
|
131
124
|
key: {
|
|
132
125
|
description: ( localizeWithPath(
|
|
133
|
-
|
|
134
|
-
|
|
126
|
+
_moduleId,
|
|
127
|
+
5,
|
|
135
128
|
'Key or key sequence (separate keys with plus-sign and sequences with space, e.g. Ctrl+O and Ctrl+L L for a chord).'
|
|
136
129
|
)),
|
|
137
130
|
type: 'string'
|
|
138
131
|
},
|
|
139
132
|
mac: {
|
|
140
|
-
description: ( localizeWithPath(
|
|
141
|
-
'vs/workbench/services/keybinding/browser/keybindingService',
|
|
142
|
-
'vscode.extension.contributes.keybindings.mac',
|
|
143
|
-
'Mac specific key or key sequence.'
|
|
144
|
-
)),
|
|
133
|
+
description: ( localizeWithPath(_moduleId, 6, 'Mac specific key or key sequence.')),
|
|
145
134
|
type: 'string'
|
|
146
135
|
},
|
|
147
136
|
linux: {
|
|
148
|
-
description: ( localizeWithPath(
|
|
149
|
-
'vs/workbench/services/keybinding/browser/keybindingService',
|
|
150
|
-
'vscode.extension.contributes.keybindings.linux',
|
|
151
|
-
'Linux specific key or key sequence.'
|
|
152
|
-
)),
|
|
137
|
+
description: ( localizeWithPath(_moduleId, 7, 'Linux specific key or key sequence.')),
|
|
153
138
|
type: 'string'
|
|
154
139
|
},
|
|
155
140
|
win: {
|
|
156
|
-
description: ( localizeWithPath(
|
|
157
|
-
'vs/workbench/services/keybinding/browser/keybindingService',
|
|
158
|
-
'vscode.extension.contributes.keybindings.win',
|
|
159
|
-
'Windows specific key or key sequence.'
|
|
160
|
-
)),
|
|
141
|
+
description: ( localizeWithPath(_moduleId, 8, 'Windows specific key or key sequence.')),
|
|
161
142
|
type: 'string'
|
|
162
143
|
},
|
|
163
144
|
when: {
|
|
164
|
-
description: ( localizeWithPath(
|
|
165
|
-
'vs/workbench/services/keybinding/browser/keybindingService',
|
|
166
|
-
'vscode.extension.contributes.keybindings.when',
|
|
167
|
-
'Condition when the key is active.'
|
|
168
|
-
)),
|
|
145
|
+
description: ( localizeWithPath(_moduleId, 9, 'Condition when the key is active.')),
|
|
169
146
|
type: 'string'
|
|
170
147
|
},
|
|
171
148
|
}
|
|
@@ -174,11 +151,7 @@ const keybindingsExtPoint = ExtensionsRegistry.registerExtensionPoint({
|
|
|
174
151
|
extensionPoint: 'keybindings',
|
|
175
152
|
deps: [commandsExtensionPoint],
|
|
176
153
|
jsonSchema: {
|
|
177
|
-
description: ( localizeWithPath(
|
|
178
|
-
'vs/workbench/services/keybinding/browser/keybindingService',
|
|
179
|
-
'vscode.extension.contributes.keybindings',
|
|
180
|
-
"Contributes keybindings."
|
|
181
|
-
)),
|
|
154
|
+
description: ( localizeWithPath(_moduleId, 10, "Contributes keybindings.")),
|
|
182
155
|
oneOf: [
|
|
183
156
|
keybindingType,
|
|
184
157
|
{
|
|
@@ -205,7 +178,7 @@ const NUMPAD_PRINTABLE_SCANCODES = [
|
|
|
205
178
|
104 ,
|
|
206
179
|
105
|
|
207
180
|
];
|
|
208
|
-
const otherMacNumpadMapping = ( new Map());
|
|
181
|
+
const otherMacNumpadMapping = ( (new Map()));
|
|
209
182
|
otherMacNumpadMapping.set(95 , 22 );
|
|
210
183
|
otherMacNumpadMapping.set(96 , 23 );
|
|
211
184
|
otherMacNumpadMapping.set(97 , 24 );
|
|
@@ -223,7 +196,7 @@ let WorkbenchKeybindingService = WorkbenchKeybindingService_1 = class WorkbenchK
|
|
|
223
196
|
this.keyboardLayoutService = keyboardLayoutService;
|
|
224
197
|
this._contributions = [];
|
|
225
198
|
this.isComposingGlobalContextKey = contextKeyService.createKey('isComposing', false);
|
|
226
|
-
this.kbsJsonSchema = ( new KeybindingsJsonSchema());
|
|
199
|
+
this.kbsJsonSchema = ( (new KeybindingsJsonSchema()));
|
|
227
200
|
this.updateKeybindingsJsonSchema();
|
|
228
201
|
this._keyboardMapper = this.keyboardLayoutService.getKeyboardMapper();
|
|
229
202
|
this._register(this.keyboardLayoutService.onDidChangeKeyboardLayout(() => {
|
|
@@ -232,7 +205,7 @@ let WorkbenchKeybindingService = WorkbenchKeybindingService_1 = class WorkbenchK
|
|
|
232
205
|
}));
|
|
233
206
|
this._keybindingHoldMode = null;
|
|
234
207
|
this._cachedResolver = null;
|
|
235
|
-
this.userKeybindings = this._register(( new UserKeybindings(userDataProfileService, uriIdentityService, fileService, logService)));
|
|
208
|
+
this.userKeybindings = this._register(( (new UserKeybindings(userDataProfileService, uriIdentityService, fileService, logService))));
|
|
236
209
|
this.userKeybindings.initialize().then(() => {
|
|
237
210
|
if (this.userKeybindings.keybindings.length) {
|
|
238
211
|
this.updateResolver();
|
|
@@ -272,13 +245,13 @@ let WorkbenchKeybindingService = WorkbenchKeybindingService_1 = class WorkbenchK
|
|
|
272
245
|
}));
|
|
273
246
|
}
|
|
274
247
|
_registerKeyListeners(window) {
|
|
275
|
-
const disposables = ( new DisposableStore());
|
|
248
|
+
const disposables = ( (new DisposableStore()));
|
|
276
249
|
disposables.add(addDisposableListener(window, EventType.KEY_DOWN, (e) => {
|
|
277
250
|
if (this._keybindingHoldMode) {
|
|
278
251
|
return;
|
|
279
252
|
}
|
|
280
253
|
this.isComposingGlobalContextKey.set(e.isComposing);
|
|
281
|
-
const keyEvent = ( new StandardKeyboardEvent(e));
|
|
254
|
+
const keyEvent = ( (new StandardKeyboardEvent(e)));
|
|
282
255
|
this._log(`/ Received keydown event - ${printKeyboardEvent(e)}`);
|
|
283
256
|
this._log(`| Converted keydown event - ${printStandardKeyboardEvent(keyEvent)}`);
|
|
284
257
|
const shouldPreventDefault = this._dispatch(keyEvent, keyEvent.target);
|
|
@@ -290,7 +263,7 @@ let WorkbenchKeybindingService = WorkbenchKeybindingService_1 = class WorkbenchK
|
|
|
290
263
|
disposables.add(addDisposableListener(window, EventType.KEY_UP, (e) => {
|
|
291
264
|
this._resetKeybindingHoldMode();
|
|
292
265
|
this.isComposingGlobalContextKey.set(e.isComposing);
|
|
293
|
-
const keyEvent = ( new StandardKeyboardEvent(e));
|
|
266
|
+
const keyEvent = ( (new StandardKeyboardEvent(e)));
|
|
294
267
|
const shouldPreventDefault = this._singleModifierDispatch(keyEvent, keyEvent.target);
|
|
295
268
|
if (shouldPreventDefault) {
|
|
296
269
|
keyEvent.preventDefault();
|
|
@@ -312,13 +285,17 @@ let WorkbenchKeybindingService = WorkbenchKeybindingService_1 = class WorkbenchK
|
|
|
312
285
|
_printKeybinding(keybinding) {
|
|
313
286
|
return UserSettingsLabelProvider.toLabel(OS, keybinding.chords, (chord) => {
|
|
314
287
|
if (chord instanceof KeyCodeChord) {
|
|
315
|
-
return (
|
|
288
|
+
return (
|
|
289
|
+
(KeyCodeUtils.toString(chord.keyCode))
|
|
290
|
+
);
|
|
316
291
|
}
|
|
317
|
-
return (
|
|
292
|
+
return (
|
|
293
|
+
(ScanCodeUtils.toString(chord.scanCode))
|
|
294
|
+
);
|
|
318
295
|
}) || '[null]';
|
|
319
296
|
}
|
|
320
297
|
_printResolvedKeybinding(resolvedKeybinding) {
|
|
321
|
-
return ( resolvedKeybinding.getDispatchChords().map(x => x || '[null]')).join(' ');
|
|
298
|
+
return ( (resolvedKeybinding.getDispatchChords().map(x => x || '[null]'))).join(' ');
|
|
322
299
|
}
|
|
323
300
|
_printResolvedKeybindings(output, input, resolvedKeybindings) {
|
|
324
301
|
const padLength = 35;
|
|
@@ -334,7 +311,7 @@ let WorkbenchKeybindingService = WorkbenchKeybindingService_1 = class WorkbenchK
|
|
|
334
311
|
}
|
|
335
312
|
}
|
|
336
313
|
_dumpResolveKeybindingDebugInfo() {
|
|
337
|
-
const seenBindings = ( new Set());
|
|
314
|
+
const seenBindings = ( (new Set()));
|
|
338
315
|
const result = [];
|
|
339
316
|
result.push(`Default Resolved Keybindings (unique only):`);
|
|
340
317
|
for (const item of KeybindingsRegistry.getDefaultKeybindings()) {
|
|
@@ -342,7 +319,7 @@ let WorkbenchKeybindingService = WorkbenchKeybindingService_1 = class WorkbenchK
|
|
|
342
319
|
continue;
|
|
343
320
|
}
|
|
344
321
|
const input = this._printKeybinding(item.keybinding);
|
|
345
|
-
if (( seenBindings.has(input))) {
|
|
322
|
+
if (( (seenBindings.has(input)))) {
|
|
346
323
|
continue;
|
|
347
324
|
}
|
|
348
325
|
seenBindings.add(input);
|
|
@@ -355,7 +332,7 @@ let WorkbenchKeybindingService = WorkbenchKeybindingService_1 = class WorkbenchK
|
|
|
355
332
|
continue;
|
|
356
333
|
}
|
|
357
334
|
const input = item._sourceKey ?? 'Impossible: missing source key, but has keybinding';
|
|
358
|
-
if (( seenBindings.has(input))) {
|
|
335
|
+
if (( (seenBindings.has(input)))) {
|
|
359
336
|
continue;
|
|
360
337
|
}
|
|
361
338
|
seenBindings.add(input);
|
|
@@ -382,7 +359,7 @@ let WorkbenchKeybindingService = WorkbenchKeybindingService_1 = class WorkbenchK
|
|
|
382
359
|
if (this._currentlyDispatchingCommandId !== commandId) {
|
|
383
360
|
return undefined;
|
|
384
361
|
}
|
|
385
|
-
this._keybindingHoldMode = ( new DeferredPromise());
|
|
362
|
+
this._keybindingHoldMode = ( (new DeferredPromise()));
|
|
386
363
|
const focusTracker = trackFocus(getWindow(undefined));
|
|
387
364
|
const listener = focusTracker.onDidBlur(() => this._resetKeybindingHoldMode());
|
|
388
365
|
this._keybindingHoldMode.p.finally(() => {
|
|
@@ -412,7 +389,7 @@ let WorkbenchKeybindingService = WorkbenchKeybindingService_1 = class WorkbenchK
|
|
|
412
389
|
if (!this._cachedResolver) {
|
|
413
390
|
const defaults = this._resolveKeybindingItems(KeybindingsRegistry.getDefaultKeybindings(), true);
|
|
414
391
|
const overrides = this.getUserKeybindingItems();
|
|
415
|
-
this._cachedResolver = ( new KeybindingResolver(defaults, overrides, (str) => this._log(str)));
|
|
392
|
+
this._cachedResolver = ( (new KeybindingResolver(defaults, overrides, (str) => this._log(str))));
|
|
416
393
|
}
|
|
417
394
|
return this._cachedResolver;
|
|
418
395
|
}
|
|
@@ -426,7 +403,7 @@ let WorkbenchKeybindingService = WorkbenchKeybindingService_1 = class WorkbenchK
|
|
|
426
403
|
const when = item.when || undefined;
|
|
427
404
|
const keybinding = item.keybinding;
|
|
428
405
|
if (!keybinding) {
|
|
429
|
-
result[resultLen++] = ( new ResolvedKeybindingItem(
|
|
406
|
+
result[resultLen++] = ( (new ResolvedKeybindingItem(
|
|
430
407
|
undefined,
|
|
431
408
|
item.command,
|
|
432
409
|
item.commandArgs,
|
|
@@ -434,7 +411,7 @@ let WorkbenchKeybindingService = WorkbenchKeybindingService_1 = class WorkbenchK
|
|
|
434
411
|
isDefault,
|
|
435
412
|
item.extensionId,
|
|
436
413
|
item.isBuiltinExtension
|
|
437
|
-
));
|
|
414
|
+
)));
|
|
438
415
|
}
|
|
439
416
|
else {
|
|
440
417
|
if (this._assertBrowserConflicts(keybinding)) {
|
|
@@ -443,7 +420,7 @@ let WorkbenchKeybindingService = WorkbenchKeybindingService_1 = class WorkbenchK
|
|
|
443
420
|
const resolvedKeybindings = this._keyboardMapper.resolveKeybinding(keybinding);
|
|
444
421
|
for (let i = resolvedKeybindings.length - 1; i >= 0; i--) {
|
|
445
422
|
const resolvedKeybinding = resolvedKeybindings[i];
|
|
446
|
-
result[resultLen++] = ( new ResolvedKeybindingItem(
|
|
423
|
+
result[resultLen++] = ( (new ResolvedKeybindingItem(
|
|
447
424
|
resolvedKeybinding,
|
|
448
425
|
item.command,
|
|
449
426
|
item.commandArgs,
|
|
@@ -451,7 +428,7 @@ let WorkbenchKeybindingService = WorkbenchKeybindingService_1 = class WorkbenchK
|
|
|
451
428
|
isDefault,
|
|
452
429
|
item.extensionId,
|
|
453
430
|
item.isBuiltinExtension
|
|
454
|
-
));
|
|
431
|
+
)));
|
|
455
432
|
}
|
|
456
433
|
}
|
|
457
434
|
}
|
|
@@ -463,12 +440,12 @@ let WorkbenchKeybindingService = WorkbenchKeybindingService_1 = class WorkbenchK
|
|
|
463
440
|
for (const item of items) {
|
|
464
441
|
const when = item.when || undefined;
|
|
465
442
|
if (!item.keybinding) {
|
|
466
|
-
result[resultLen++] = ( new ResolvedKeybindingItem(undefined, item.command, item.commandArgs, when, isDefault, null, false));
|
|
443
|
+
result[resultLen++] = ( (new ResolvedKeybindingItem(undefined, item.command, item.commandArgs, when, isDefault, null, false)));
|
|
467
444
|
}
|
|
468
445
|
else {
|
|
469
446
|
const resolvedKeybindings = this._keyboardMapper.resolveKeybinding(item.keybinding);
|
|
470
447
|
for (const resolvedKeybinding of resolvedKeybindings) {
|
|
471
|
-
result[resultLen++] = ( new ResolvedKeybindingItem(
|
|
448
|
+
result[resultLen++] = ( (new ResolvedKeybindingItem(
|
|
472
449
|
resolvedKeybinding,
|
|
473
450
|
item.command,
|
|
474
451
|
item.commandArgs,
|
|
@@ -476,7 +453,7 @@ let WorkbenchKeybindingService = WorkbenchKeybindingService_1 = class WorkbenchK
|
|
|
476
453
|
isDefault,
|
|
477
454
|
null,
|
|
478
455
|
false
|
|
479
|
-
));
|
|
456
|
+
)));
|
|
480
457
|
}
|
|
481
458
|
}
|
|
482
459
|
}
|
|
@@ -557,8 +534,8 @@ let WorkbenchKeybindingService = WorkbenchKeybindingService_1 = class WorkbenchK
|
|
|
557
534
|
}
|
|
558
535
|
if (rejects.length > 0) {
|
|
559
536
|
collector.error(( localizeWithPath(
|
|
560
|
-
|
|
561
|
-
|
|
537
|
+
_moduleId,
|
|
538
|
+
11,
|
|
562
539
|
"Invalid `contributes.{0}`: {1}",
|
|
563
540
|
keybindingsExtPoint.name,
|
|
564
541
|
rejects.join('\n')
|
|
@@ -600,7 +577,7 @@ let WorkbenchKeybindingService = WorkbenchKeybindingService_1 = class WorkbenchK
|
|
|
600
577
|
const precondition = commandAction && commandAction.precondition;
|
|
601
578
|
let fullWhen;
|
|
602
579
|
if (when && precondition) {
|
|
603
|
-
fullWhen = ( ContextKeyExpr.and(precondition, ContextKeyExpr.deserialize(when)));
|
|
580
|
+
fullWhen = ( (ContextKeyExpr.and(precondition, ContextKeyExpr.deserialize(when))));
|
|
604
581
|
}
|
|
605
582
|
else if (when) {
|
|
606
583
|
fullWhen = ContextKeyExpr.deserialize(when);
|
|
@@ -628,7 +605,7 @@ let WorkbenchKeybindingService = WorkbenchKeybindingService_1 = class WorkbenchK
|
|
|
628
605
|
+ WorkbenchKeybindingService_1._getAllCommandsAsComment(boundCommands));
|
|
629
606
|
}
|
|
630
607
|
static _getDefaultKeybindings(defaultKeybindings) {
|
|
631
|
-
const out = ( new OutputBuilder());
|
|
608
|
+
const out = ( (new OutputBuilder()));
|
|
632
609
|
out.writeLine('[');
|
|
633
610
|
const lastIndex = defaultKeybindings.length - 1;
|
|
634
611
|
defaultKeybindings.forEach((k, index) => {
|
|
@@ -641,16 +618,14 @@ let WorkbenchKeybindingService = WorkbenchKeybindingService_1 = class WorkbenchK
|
|
|
641
618
|
}
|
|
642
619
|
});
|
|
643
620
|
out.writeLine(']');
|
|
644
|
-
return (
|
|
621
|
+
return (
|
|
622
|
+
(out.toString())
|
|
623
|
+
);
|
|
645
624
|
}
|
|
646
625
|
static _getAllCommandsAsComment(boundCommands) {
|
|
647
626
|
const unboundCommands = getAllUnboundCommands(boundCommands);
|
|
648
627
|
const pretty = unboundCommands.sort().join('\n// - ');
|
|
649
|
-
return '// ' + ( localizeWithPath(
|
|
650
|
-
'vs/workbench/services/keybinding/browser/keybindingService',
|
|
651
|
-
'unboundCommands',
|
|
652
|
-
"Here are other available commands: "
|
|
653
|
-
)) + '\n// - ' + pretty;
|
|
628
|
+
return '// ' + ( localizeWithPath(_moduleId, 12, "Here are other available commands: ")) + '\n// - ' + pretty;
|
|
654
629
|
}
|
|
655
630
|
mightProducePrintableCharacter(event) {
|
|
656
631
|
if (event.ctrlKey || event.metaKey || event.altKey) {
|
|
@@ -684,19 +659,19 @@ let WorkbenchKeybindingService = WorkbenchKeybindingService_1 = class WorkbenchK
|
|
|
684
659
|
return true;
|
|
685
660
|
}
|
|
686
661
|
};
|
|
687
|
-
WorkbenchKeybindingService = WorkbenchKeybindingService_1 = ( __decorate([
|
|
688
|
-
( __param(0, IContextKeyService)),
|
|
689
|
-
( __param(1, ICommandService)),
|
|
690
|
-
( __param(2, ITelemetryService)),
|
|
691
|
-
( __param(3, INotificationService)),
|
|
692
|
-
( __param(4, IUserDataProfileService)),
|
|
693
|
-
( __param(5, IHostService)),
|
|
694
|
-
( __param(6, IExtensionService)),
|
|
695
|
-
( __param(7, IFileService)),
|
|
696
|
-
( __param(8, IUriIdentityService)),
|
|
697
|
-
( __param(9, ILogService)),
|
|
698
|
-
( __param(10, IKeyboardLayoutService))
|
|
699
|
-
], WorkbenchKeybindingService));
|
|
662
|
+
WorkbenchKeybindingService = WorkbenchKeybindingService_1 = ( (__decorate([
|
|
663
|
+
( (__param(0, IContextKeyService))),
|
|
664
|
+
( (__param(1, ICommandService))),
|
|
665
|
+
( (__param(2, ITelemetryService))),
|
|
666
|
+
( (__param(3, INotificationService))),
|
|
667
|
+
( (__param(4, IUserDataProfileService))),
|
|
668
|
+
( (__param(5, IHostService))),
|
|
669
|
+
( (__param(6, IExtensionService))),
|
|
670
|
+
( (__param(7, IFileService))),
|
|
671
|
+
( (__param(8, IUriIdentityService))),
|
|
672
|
+
( (__param(9, ILogService))),
|
|
673
|
+
( (__param(10, IKeyboardLayoutService)))
|
|
674
|
+
], WorkbenchKeybindingService)));
|
|
700
675
|
class UserKeybindings extends Disposable {
|
|
701
676
|
get keybindings() { return this._keybindings; }
|
|
702
677
|
constructor(userDataProfileService, uriIdentityService, fileService, logService) {
|
|
@@ -706,21 +681,21 @@ class UserKeybindings extends Disposable {
|
|
|
706
681
|
this.fileService = fileService;
|
|
707
682
|
this._rawKeybindings = [];
|
|
708
683
|
this._keybindings = [];
|
|
709
|
-
this.watchDisposables = this._register(( new DisposableStore()));
|
|
710
|
-
this._onDidChange = this._register(( new Emitter()));
|
|
684
|
+
this.watchDisposables = this._register(( (new DisposableStore())));
|
|
685
|
+
this._onDidChange = this._register(( (new Emitter())));
|
|
711
686
|
this.onDidChange = this._onDidChange.event;
|
|
712
687
|
this.watch();
|
|
713
|
-
this.reloadConfigurationScheduler = this._register(( new RunOnceScheduler(() => this.reload().then(changed => {
|
|
688
|
+
this.reloadConfigurationScheduler = this._register(( (new RunOnceScheduler(() => this.reload().then(changed => {
|
|
714
689
|
if (changed) {
|
|
715
690
|
this._onDidChange.fire();
|
|
716
691
|
}
|
|
717
|
-
}), 50)));
|
|
692
|
+
}), 50))));
|
|
718
693
|
this._register(Event.filter(this.fileService.onDidFilesChange, e => e.contains(this.userDataProfileService.currentProfile.keybindingsResource))(() => {
|
|
719
694
|
logService.debug('Keybindings file changed');
|
|
720
695
|
this.reloadConfigurationScheduler.schedule();
|
|
721
696
|
}));
|
|
722
697
|
this._register(this.fileService.onDidRunOperation((e) => {
|
|
723
|
-
if (e.operation === 4 && ( e.resource.toString()) === ( this.userDataProfileService.currentProfile.keybindingsResource.toString())) {
|
|
698
|
+
if (e.operation === 4 && ( (e.resource.toString())) === ( (this.userDataProfileService.currentProfile.keybindingsResource.toString()))) {
|
|
724
699
|
logService.debug('Keybindings file written');
|
|
725
700
|
this.reloadConfigurationScheduler.schedule();
|
|
726
701
|
}
|
|
@@ -749,13 +724,13 @@ class UserKeybindings extends Disposable {
|
|
|
749
724
|
return false;
|
|
750
725
|
}
|
|
751
726
|
this._rawKeybindings = newKeybindings;
|
|
752
|
-
this._keybindings = ( this._rawKeybindings.map((k) => KeybindingIO.readUserKeybindingItem(k)));
|
|
727
|
+
this._keybindings = ( (this._rawKeybindings.map((k) => KeybindingIO.readUserKeybindingItem(k))));
|
|
753
728
|
return true;
|
|
754
729
|
}
|
|
755
730
|
async readUserKeybindings() {
|
|
756
731
|
try {
|
|
757
732
|
const content = await this.fileService.readFile(this.userDataProfileService.currentProfile.keybindingsResource);
|
|
758
|
-
const value = parse(( content.value.toString()));
|
|
733
|
+
const value = parse(( (content.value.toString())));
|
|
759
734
|
return Array.isArray(value)
|
|
760
735
|
? value.filter(v => v && typeof v === 'object' )
|
|
761
736
|
: [];
|
|
@@ -775,11 +750,7 @@ class KeybindingsJsonSchema {
|
|
|
775
750
|
this.schema = {
|
|
776
751
|
id: KeybindingsJsonSchema.schemaId,
|
|
777
752
|
type: 'array',
|
|
778
|
-
title: ( localizeWithPath(
|
|
779
|
-
'vs/workbench/services/keybinding/browser/keybindingService',
|
|
780
|
-
'keybindings.json.title',
|
|
781
|
-
"Keybindings configuration"
|
|
782
|
-
)),
|
|
753
|
+
title: ( localizeWithPath(_moduleId, 13, "Keybindings configuration")),
|
|
783
754
|
allowTrailingCommas: true,
|
|
784
755
|
allowComments: true,
|
|
785
756
|
definitions: {
|
|
@@ -803,11 +774,7 @@ class KeybindingsJsonSchema {
|
|
|
803
774
|
'type': 'string',
|
|
804
775
|
'enum': this.commandsEnum,
|
|
805
776
|
'enumDescriptions': this.commandsEnumDescriptions,
|
|
806
|
-
'description': ( localizeWithPath(
|
|
807
|
-
'vs/workbench/services/keybinding/browser/keybindingService',
|
|
808
|
-
'keybindings.json.command',
|
|
809
|
-
"Name of the command to execute"
|
|
810
|
-
)),
|
|
777
|
+
'description': ( localizeWithPath(_moduleId, 14, "Name of the command to execute")),
|
|
811
778
|
},
|
|
812
779
|
'commandType': {
|
|
813
780
|
'anyOf': [
|
|
@@ -818,11 +785,7 @@ class KeybindingsJsonSchema {
|
|
|
818
785
|
'type': 'string',
|
|
819
786
|
'enum': this.removalCommandsEnum,
|
|
820
787
|
'enumDescriptions': this.commandsEnumDescriptions,
|
|
821
|
-
'description': ( localizeWithPath(
|
|
822
|
-
'vs/workbench/services/keybinding/browser/keybindingService',
|
|
823
|
-
'keybindings.json.removalCommand',
|
|
824
|
-
"Name of the command to remove keyboard shortcut for"
|
|
825
|
-
)),
|
|
788
|
+
'description': ( localizeWithPath(_moduleId, 15, "Name of the command to remove keyboard shortcut for")),
|
|
826
789
|
},
|
|
827
790
|
{
|
|
828
791
|
'type': 'string'
|
|
@@ -840,11 +803,7 @@ class KeybindingsJsonSchema {
|
|
|
840
803
|
'properties': {
|
|
841
804
|
'key': {
|
|
842
805
|
'type': 'string',
|
|
843
|
-
'description': ( localizeWithPath(
|
|
844
|
-
'vs/workbench/services/keybinding/browser/keybindingService',
|
|
845
|
-
'keybindings.json.key',
|
|
846
|
-
"Key or key sequence (separated by space)"
|
|
847
|
-
)),
|
|
806
|
+
'description': ( localizeWithPath(_moduleId, 16, "Key or key sequence (separated by space)")),
|
|
848
807
|
},
|
|
849
808
|
'command': {
|
|
850
809
|
'anyOf': [
|
|
@@ -857,8 +816,8 @@ class KeybindingsJsonSchema {
|
|
|
857
816
|
'type': 'array'
|
|
858
817
|
},
|
|
859
818
|
'errorMessage': ( localizeWithPath(
|
|
860
|
-
|
|
861
|
-
|
|
819
|
+
_moduleId,
|
|
820
|
+
17,
|
|
862
821
|
"Incorrect type. Expected \"{0}\". The field 'command' does not support running multiple commands. Use command 'runCommands' to pass it multiple commands to run.",
|
|
863
822
|
'string'
|
|
864
823
|
))
|
|
@@ -874,24 +833,16 @@ class KeybindingsJsonSchema {
|
|
|
874
833
|
},
|
|
875
834
|
'when': {
|
|
876
835
|
'type': 'string',
|
|
877
|
-
'description': ( localizeWithPath(
|
|
878
|
-
'vs/workbench/services/keybinding/browser/keybindingService',
|
|
879
|
-
'keybindings.json.when',
|
|
880
|
-
"Condition when the key is active."
|
|
881
|
-
))
|
|
836
|
+
'description': ( localizeWithPath(_moduleId, 18, "Condition when the key is active."))
|
|
882
837
|
},
|
|
883
838
|
'args': {
|
|
884
|
-
'description': ( localizeWithPath(
|
|
885
|
-
'vs/workbench/services/keybinding/browser/keybindingService',
|
|
886
|
-
'keybindings.json.args',
|
|
887
|
-
"Arguments to pass to the command to execute."
|
|
888
|
-
))
|
|
839
|
+
'description': ( localizeWithPath(_moduleId, 19, "Arguments to pass to the command to execute."))
|
|
889
840
|
}
|
|
890
841
|
},
|
|
891
842
|
'$ref': '#/definitions/commandsSchemas'
|
|
892
843
|
}
|
|
893
844
|
};
|
|
894
|
-
this.schemaRegistry = ( Registry.as(Extensions.JSONContribution));
|
|
845
|
+
this.schemaRegistry = ( (Registry.as(Extensions.JSONContribution)));
|
|
895
846
|
this.schemaRegistry.registerSchema(KeybindingsJsonSchema.schemaId, this.schema);
|
|
896
847
|
}
|
|
897
848
|
updateSchema(additionalContributions) {
|
|
@@ -899,10 +850,10 @@ class KeybindingsJsonSchema {
|
|
|
899
850
|
this.commandsEnum.length = 0;
|
|
900
851
|
this.removalCommandsEnum.length = 0;
|
|
901
852
|
this.commandsEnumDescriptions.length = 0;
|
|
902
|
-
const knownCommands = ( new Set());
|
|
853
|
+
const knownCommands = ( (new Set()));
|
|
903
854
|
const addKnownCommand = (commandId, description) => {
|
|
904
855
|
if (!/^_/.test(commandId)) {
|
|
905
|
-
if (!( knownCommands.has(commandId))) {
|
|
856
|
+
if (!( (knownCommands.has(commandId)))) {
|
|
906
857
|
knownCommands.add(commandId);
|
|
907
858
|
this.commandsEnum.push(commandId);
|
|
908
859
|
this.commandsEnumDescriptions.push(isLocalizedString(description) ? description.value : description);
|
|
@@ -938,7 +889,7 @@ class KeybindingsJsonSchema {
|
|
|
938
889
|
this.commandsSchemas.push(addition);
|
|
939
890
|
}
|
|
940
891
|
const menuCommands = MenuRegistry.getCommands();
|
|
941
|
-
for (const commandId of ( menuCommands.keys())) {
|
|
892
|
+
for (const commandId of ( (menuCommands.keys()))) {
|
|
942
893
|
addKnownCommand(commandId);
|
|
943
894
|
}
|
|
944
895
|
this.commandsSchemas.push(...additionalContributions);
|