@codingame/monaco-vscode-keybindings-service-override 5.2.0 → 6.0.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.
- package/package.json +3 -3
- package/vscode/src/vs/platform/keyboardLayout/common/keyboardConfig.js +13 -8
- package/vscode/src/vs/workbench/browser/contextkeys.js +41 -81
- package/vscode/src/vs/workbench/contrib/commands/common/commands.contribution.js +5 -4
- package/vscode/src/vs/workbench/contrib/preferences/browser/keybindingsEditorContribution.js +4 -4
- package/vscode/src/vs/workbench/contrib/preferences/common/smartSnippetInserter.js +11 -11
- package/vscode/src/vs/workbench/services/commands/common/commandService.js +1 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keybindingService.js +51 -49
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayoutService.js +5 -4
- package/vscode/src/vs/workbench/services/keybinding/common/macLinuxKeyboardMapper.js +175 -178
- package/vscode/src/vs/workbench/services/keybinding/common/windowsKeyboardMapper.js +70 -68
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
|
|
2
2
|
import { localizeWithPath } from 'vscode/vscode/vs/nls';
|
|
3
3
|
import { onDidChangeFullscreen, isFullscreen } from 'vscode/vscode/vs/base/browser/browser';
|
|
4
|
-
import { BrowserFeatures } from 'vscode/vscode/vs/base/browser/canIUse';
|
|
4
|
+
import { BrowserFeatures, KeyboardSupport } from 'vscode/vscode/vs/base/browser/canIUse';
|
|
5
5
|
import { onDidRegisterWindow, addDisposableListener, EventType, trackFocus, getWindow } from 'vscode/vscode/vs/base/browser/dom';
|
|
6
6
|
import { StandardKeyboardEvent, printKeyboardEvent, printStandardKeyboardEvent } from 'vscode/vscode/vs/base/browser/keyboardEvent';
|
|
7
7
|
import { DeferredPromise, RunOnceScheduler } from 'vscode/vscode/vs/base/common/async';
|
|
@@ -10,10 +10,10 @@ import { parse } from 'vscode/vscode/vs/base/common/json';
|
|
|
10
10
|
import { UserSettingsLabelProvider } from 'vscode/vscode/vs/base/common/keybindingLabels';
|
|
11
11
|
import { KeybindingParser } from 'vscode/vscode/vs/base/common/keybindingParser';
|
|
12
12
|
import { KeyCodeChord, ScanCodeChord } from 'vscode/vscode/vs/base/common/keybindings';
|
|
13
|
-
import { KeyCodeUtils, ScanCodeUtils, IMMUTABLE_CODE_TO_KEY_CODE } from 'vscode/vscode/vs/base/common/keyCodes';
|
|
13
|
+
import { ScanCode, KeyCode, KeyCodeUtils, ScanCodeUtils, KeyMod, IMMUTABLE_CODE_TO_KEY_CODE } from 'vscode/vscode/vs/base/common/keyCodes';
|
|
14
14
|
import { DisposableStore, Disposable } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
15
15
|
import { equals } from 'vscode/vscode/vs/base/common/objects';
|
|
16
|
-
import { OS, isMacintosh } from 'vscode/vscode/vs/base/common/platform';
|
|
16
|
+
import { OS, OperatingSystem, isMacintosh } from 'vscode/vscode/vs/base/common/platform';
|
|
17
17
|
import { dirname } from 'vscode/vscode/vs/base/common/resources';
|
|
18
18
|
import { mainWindow } from 'vscode/vscode/vs/base/browser/window';
|
|
19
19
|
import { MenuRegistry } from 'vscode/vscode/vs/platform/actions/common/actions';
|
|
@@ -21,12 +21,14 @@ import { CommandsRegistry } from 'vscode/vscode/vs/platform/commands/common/comm
|
|
|
21
21
|
import { ICommandService } from 'vscode/vscode/vs/platform/commands/common/commands.service';
|
|
22
22
|
import { ContextKeyExpr } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
|
|
23
23
|
import { IContextKeyService } from 'vscode/vscode/vs/platform/contextkey/common/contextkey.service';
|
|
24
|
+
import { FileOperation } from 'vscode/vscode/vs/platform/files/common/files';
|
|
24
25
|
import { IFileService } from 'vscode/vscode/vs/platform/files/common/files.service';
|
|
26
|
+
import 'vscode/vscode/vs/platform/instantiation/common/extensions';
|
|
25
27
|
import { Extensions } from 'vscode/vscode/vs/platform/jsonschemas/common/jsonContributionRegistry';
|
|
26
28
|
import { AbstractKeybindingService } from 'vscode/vscode/vs/platform/keybinding/common/abstractKeybindingService';
|
|
27
29
|
import 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
28
30
|
import { KeybindingResolver } from 'vscode/vscode/vs/platform/keybinding/common/keybindingResolver';
|
|
29
|
-
import { KeybindingsRegistry } from 'vscode/vscode/vs/platform/keybinding/common/keybindingsRegistry';
|
|
31
|
+
import { KeybindingsRegistry, KeybindingWeight } from 'vscode/vscode/vs/platform/keybinding/common/keybindingsRegistry';
|
|
30
32
|
import { ResolvedKeybindingItem } from 'vscode/vscode/vs/platform/keybinding/common/resolvedKeybindingItem';
|
|
31
33
|
import { IKeyboardLayoutService } from 'vscode/vscode/vs/platform/keyboardLayout/common/keyboardLayout.service';
|
|
32
34
|
import { ILogService } from 'vscode/vscode/vs/platform/log/common/log.service';
|
|
@@ -162,33 +164,33 @@ const keybindingsExtPoint = ExtensionsRegistry.registerExtensionPoint({
|
|
|
162
164
|
}
|
|
163
165
|
});
|
|
164
166
|
const NUMPAD_PRINTABLE_SCANCODES = [
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
167
|
+
ScanCode.NumpadDivide,
|
|
168
|
+
ScanCode.NumpadMultiply,
|
|
169
|
+
ScanCode.NumpadSubtract,
|
|
170
|
+
ScanCode.NumpadAdd,
|
|
171
|
+
ScanCode.Numpad1,
|
|
172
|
+
ScanCode.Numpad2,
|
|
173
|
+
ScanCode.Numpad3,
|
|
174
|
+
ScanCode.Numpad4,
|
|
175
|
+
ScanCode.Numpad5,
|
|
176
|
+
ScanCode.Numpad6,
|
|
177
|
+
ScanCode.Numpad7,
|
|
178
|
+
ScanCode.Numpad8,
|
|
179
|
+
ScanCode.Numpad9,
|
|
180
|
+
ScanCode.Numpad0,
|
|
181
|
+
ScanCode.NumpadDecimal
|
|
180
182
|
];
|
|
181
183
|
const otherMacNumpadMapping = ( (new Map()));
|
|
182
|
-
otherMacNumpadMapping.set(
|
|
183
|
-
otherMacNumpadMapping.set(
|
|
184
|
-
otherMacNumpadMapping.set(
|
|
185
|
-
otherMacNumpadMapping.set(
|
|
186
|
-
otherMacNumpadMapping.set(
|
|
187
|
-
otherMacNumpadMapping.set(
|
|
188
|
-
otherMacNumpadMapping.set(
|
|
189
|
-
otherMacNumpadMapping.set(
|
|
190
|
-
otherMacNumpadMapping.set(
|
|
191
|
-
otherMacNumpadMapping.set(
|
|
184
|
+
otherMacNumpadMapping.set(ScanCode.Numpad1, KeyCode.Digit1);
|
|
185
|
+
otherMacNumpadMapping.set(ScanCode.Numpad2, KeyCode.Digit2);
|
|
186
|
+
otherMacNumpadMapping.set(ScanCode.Numpad3, KeyCode.Digit3);
|
|
187
|
+
otherMacNumpadMapping.set(ScanCode.Numpad4, KeyCode.Digit4);
|
|
188
|
+
otherMacNumpadMapping.set(ScanCode.Numpad5, KeyCode.Digit5);
|
|
189
|
+
otherMacNumpadMapping.set(ScanCode.Numpad6, KeyCode.Digit6);
|
|
190
|
+
otherMacNumpadMapping.set(ScanCode.Numpad7, KeyCode.Digit7);
|
|
191
|
+
otherMacNumpadMapping.set(ScanCode.Numpad8, KeyCode.Digit8);
|
|
192
|
+
otherMacNumpadMapping.set(ScanCode.Numpad9, KeyCode.Digit9);
|
|
193
|
+
otherMacNumpadMapping.set(ScanCode.Numpad0, KeyCode.Digit0);
|
|
192
194
|
let WorkbenchKeybindingService = WorkbenchKeybindingService_1 = class WorkbenchKeybindingService extends AbstractKeybindingService {
|
|
193
195
|
constructor(contextKeyService, commandService, telemetryService, notificationService, userDataProfileService, hostService, extensionService, fileService, uriIdentityService, logService, keyboardLayoutService) {
|
|
194
196
|
super(contextKeyService, commandService, telemetryService, notificationService, logService);
|
|
@@ -231,7 +233,7 @@ let WorkbenchKeybindingService = WorkbenchKeybindingService_1 = class WorkbenchK
|
|
|
231
233
|
return;
|
|
232
234
|
}
|
|
233
235
|
const keyboard = navigator.keyboard;
|
|
234
|
-
if (BrowserFeatures.keyboard ===
|
|
236
|
+
if (BrowserFeatures.keyboard === KeyboardSupport.None) {
|
|
235
237
|
return;
|
|
236
238
|
}
|
|
237
239
|
if (isFullscreen(mainWindow)) {
|
|
@@ -460,43 +462,43 @@ let WorkbenchKeybindingService = WorkbenchKeybindingService_1 = class WorkbenchK
|
|
|
460
462
|
return result;
|
|
461
463
|
}
|
|
462
464
|
_assertBrowserConflicts(keybinding) {
|
|
463
|
-
if (BrowserFeatures.keyboard ===
|
|
465
|
+
if (BrowserFeatures.keyboard === KeyboardSupport.Always) {
|
|
464
466
|
return false;
|
|
465
467
|
}
|
|
466
|
-
if (BrowserFeatures.keyboard ===
|
|
468
|
+
if (BrowserFeatures.keyboard === KeyboardSupport.FullScreen && isFullscreen(mainWindow)) {
|
|
467
469
|
return false;
|
|
468
470
|
}
|
|
469
471
|
for (const chord of keybinding.chords) {
|
|
470
472
|
if (!chord.metaKey && !chord.altKey && !chord.ctrlKey && !chord.shiftKey) {
|
|
471
473
|
continue;
|
|
472
474
|
}
|
|
473
|
-
const modifiersMask =
|
|
475
|
+
const modifiersMask = KeyMod.CtrlCmd | KeyMod.Alt | KeyMod.Shift;
|
|
474
476
|
let partModifiersMask = 0;
|
|
475
477
|
if (chord.metaKey) {
|
|
476
|
-
partModifiersMask |=
|
|
478
|
+
partModifiersMask |= KeyMod.CtrlCmd;
|
|
477
479
|
}
|
|
478
480
|
if (chord.shiftKey) {
|
|
479
|
-
partModifiersMask |=
|
|
481
|
+
partModifiersMask |= KeyMod.Shift;
|
|
480
482
|
}
|
|
481
483
|
if (chord.altKey) {
|
|
482
|
-
partModifiersMask |=
|
|
484
|
+
partModifiersMask |= KeyMod.Alt;
|
|
483
485
|
}
|
|
484
|
-
if (chord.ctrlKey && OS ===
|
|
485
|
-
partModifiersMask |=
|
|
486
|
+
if (chord.ctrlKey && OS === OperatingSystem.Macintosh) {
|
|
487
|
+
partModifiersMask |= KeyMod.WinCtrl;
|
|
486
488
|
}
|
|
487
|
-
if ((partModifiersMask & modifiersMask) === (
|
|
488
|
-
if (chord instanceof ScanCodeChord && (
|
|
489
|
+
if ((partModifiersMask & modifiersMask) === (KeyMod.CtrlCmd | KeyMod.Alt)) {
|
|
490
|
+
if (chord instanceof ScanCodeChord && (chord.scanCode === ScanCode.ArrowLeft || chord.scanCode === ScanCode.ArrowRight)) {
|
|
489
491
|
return true;
|
|
490
492
|
}
|
|
491
|
-
if (chord instanceof KeyCodeChord && (
|
|
493
|
+
if (chord instanceof KeyCodeChord && (chord.keyCode === KeyCode.LeftArrow || chord.keyCode === KeyCode.RightArrow)) {
|
|
492
494
|
return true;
|
|
493
495
|
}
|
|
494
496
|
}
|
|
495
|
-
if ((partModifiersMask & modifiersMask) ===
|
|
496
|
-
if (chord instanceof ScanCodeChord && (
|
|
497
|
+
if ((partModifiersMask & modifiersMask) === KeyMod.CtrlCmd) {
|
|
498
|
+
if (chord instanceof ScanCodeChord && (chord.scanCode >= ScanCode.Digit1 && chord.scanCode <= ScanCode.Digit0)) {
|
|
497
499
|
return true;
|
|
498
500
|
}
|
|
499
|
-
if (chord instanceof KeyCodeChord && (
|
|
501
|
+
if (chord instanceof KeyCodeChord && (chord.keyCode >= KeyCode.Digit0 && chord.keyCode <= KeyCode.Digit9)) {
|
|
500
502
|
return true;
|
|
501
503
|
}
|
|
502
504
|
}
|
|
@@ -543,12 +545,12 @@ let WorkbenchKeybindingService = WorkbenchKeybindingService_1 = class WorkbenchK
|
|
|
543
545
|
}
|
|
544
546
|
}
|
|
545
547
|
static bindToCurrentPlatform(key, mac, linux, win) {
|
|
546
|
-
if (OS ===
|
|
548
|
+
if (OS === OperatingSystem.Windows && win) {
|
|
547
549
|
if (win) {
|
|
548
550
|
return win;
|
|
549
551
|
}
|
|
550
552
|
}
|
|
551
|
-
else if (OS ===
|
|
553
|
+
else if (OS === OperatingSystem.Macintosh) {
|
|
552
554
|
if (mac) {
|
|
553
555
|
return mac;
|
|
554
556
|
}
|
|
@@ -568,10 +570,10 @@ let WorkbenchKeybindingService = WorkbenchKeybindingService_1 = class WorkbenchK
|
|
|
568
570
|
}
|
|
569
571
|
let weight;
|
|
570
572
|
if (isBuiltin) {
|
|
571
|
-
weight =
|
|
573
|
+
weight = KeybindingWeight.BuiltinExtension + idx;
|
|
572
574
|
}
|
|
573
575
|
else {
|
|
574
|
-
weight =
|
|
576
|
+
weight = KeybindingWeight.ExternalExtension + idx;
|
|
575
577
|
}
|
|
576
578
|
const commandAction = MenuRegistry.getCommand(command);
|
|
577
579
|
const precondition = commandAction && commandAction.precondition;
|
|
@@ -695,7 +697,7 @@ class UserKeybindings extends Disposable {
|
|
|
695
697
|
this.reloadConfigurationScheduler.schedule();
|
|
696
698
|
}));
|
|
697
699
|
this._register(this.fileService.onDidRunOperation((e) => {
|
|
698
|
-
if (e.operation ===
|
|
700
|
+
if (e.operation === FileOperation.WRITE && ( (e.resource.toString())) === ( (this.userDataProfileService.currentProfile.keybindingsResource.toString()))) {
|
|
699
701
|
logService.debug('Keybindings file written');
|
|
700
702
|
this.reloadConfigurationScheduler.schedule();
|
|
701
703
|
}
|
|
@@ -3,9 +3,10 @@ import { localizeWithPath } from 'vscode/vscode/vs/nls';
|
|
|
3
3
|
import { Emitter, Event } from 'vscode/vscode/vs/base/common/event';
|
|
4
4
|
import { Disposable } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
5
5
|
import { KeymapInfo } from '../common/keymapInfo.js';
|
|
6
|
-
import
|
|
6
|
+
import 'vscode/vscode/vs/platform/instantiation/common/extensions';
|
|
7
|
+
import { readKeyboardConfig, DispatchConfig } from '../../../../platform/keyboardLayout/common/keyboardConfig.js';
|
|
7
8
|
import { CachedKeyboardMapper } from '../../../../platform/keyboardLayout/common/keyboardMapper.js';
|
|
8
|
-
import { OS, isWindows, isMacintosh } from 'vscode/vscode/vs/base/common/platform';
|
|
9
|
+
import { OS, OperatingSystem, isWindows, isMacintosh } from 'vscode/vscode/vs/base/common/platform';
|
|
9
10
|
import { WindowsKeyboardMapper } from '../common/windowsKeyboardMapper.js';
|
|
10
11
|
import { FallbackKeyboardMapper } from 'vscode/vscode/vs/workbench/services/keybinding/common/fallbackKeyboardMapper';
|
|
11
12
|
import { MacLinuxKeyboardMapper } from '../common/macLinuxKeyboardMapper.js';
|
|
@@ -206,7 +207,7 @@ class BrowserKeyboardMapperFactoryBase extends Disposable {
|
|
|
206
207
|
}
|
|
207
208
|
getKeyboardMapper() {
|
|
208
209
|
const config = readKeyboardConfig(this._configurationService);
|
|
209
|
-
if (config.dispatch ===
|
|
210
|
+
if (config.dispatch === DispatchConfig.KeyCode || !this._initialized || !this._activeKeymapInfo) {
|
|
210
211
|
return (
|
|
211
212
|
(new FallbackKeyboardMapper(config.mapAltGrToCtrlAlt, OS))
|
|
212
213
|
);
|
|
@@ -242,7 +243,7 @@ class BrowserKeyboardMapperFactoryBase extends Disposable {
|
|
|
242
243
|
static _createKeyboardMapper(keymapInfo, mapAltGrToCtrlAlt) {
|
|
243
244
|
const rawMapping = keymapInfo.mapping;
|
|
244
245
|
const isUSStandard = !!keymapInfo.layout.isUSStandard;
|
|
245
|
-
if (OS ===
|
|
246
|
+
if (OS === OperatingSystem.Windows) {
|
|
246
247
|
return (
|
|
247
248
|
(new WindowsKeyboardMapper(isUSStandard, rawMapping, mapAltGrToCtrlAlt))
|
|
248
249
|
);
|