@codingame/monaco-vscode-keybindings-service-override 9.0.2 → 10.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/keybindings.js +8 -2
- package/package.json +3 -3
- package/vscode/src/vs/platform/keyboardLayout/common/keyboardConfig.js +11 -16
- package/vscode/src/vs/workbench/browser/contextkeys.js +16 -16
- package/vscode/src/vs/workbench/contrib/commands/common/commands.contribution.js +5 -5
- package/vscode/src/vs/workbench/contrib/keybindings/browser/keybindings.contribution.js +1 -1
- package/vscode/src/vs/workbench/contrib/preferences/browser/keybindingsEditorContribution.js +7 -7
- package/vscode/src/vs/workbench/contrib/preferences/common/smartSnippetInserter.js +11 -11
- package/vscode/src/vs/workbench/services/actions/common/menusExtensionPoint.js +134 -188
- package/vscode/src/vs/workbench/services/commands/common/commandService.js +0 -1
- package/vscode/src/vs/workbench/services/keybinding/browser/keybindingService.js +73 -75
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayoutService.js +6 -7
- package/vscode/src/vs/workbench/services/keybinding/common/macLinuxKeyboardMapper.js +178 -175
- package/vscode/src/vs/workbench/services/keybinding/common/windowsKeyboardMapper.js +68 -70
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { KeyCodeUtils, KeyCode, ScanCode, IMMUTABLE_CODE_TO_KEY_CODE, ScanCodeUtils, NATIVE_WINDOWS_KEY_CODE_TO_KEY_CODE } from 'vscode/vscode/vs/base/common/keyCodes';
|
|
1
|
+
import { KeyCodeUtils, IMMUTABLE_CODE_TO_KEY_CODE, ScanCodeUtils, NATIVE_WINDOWS_KEY_CODE_TO_KEY_CODE } from 'vscode/vscode/vs/base/common/keyCodes';
|
|
3
2
|
import { ScanCodeChord, KeyCodeChord } from 'vscode/vscode/vs/base/common/keybindings';
|
|
4
3
|
import { UILabelProvider } from 'vscode/vscode/vs/base/common/keybindingLabels';
|
|
5
|
-
import { OperatingSystem } from 'vscode/vscode/vs/base/common/platform';
|
|
6
4
|
import { BaseResolvedKeybinding } from 'vscode/vscode/vs/platform/keybinding/common/baseResolvedKeybinding';
|
|
7
5
|
import { toEmptyArrayIfContainsNull } from 'vscode/vscode/vs/platform/keybinding/common/resolvedKeybindingItem';
|
|
8
6
|
|
|
9
7
|
class WindowsNativeResolvedKeybinding extends BaseResolvedKeybinding {
|
|
10
8
|
constructor(mapper, chords) {
|
|
11
|
-
super(
|
|
9
|
+
super(1 , chords);
|
|
12
10
|
this._mapper = mapper;
|
|
13
11
|
}
|
|
14
12
|
_getLabel(chord) {
|
|
@@ -46,10 +44,10 @@ class WindowsNativeResolvedKeybinding extends BaseResolvedKeybinding {
|
|
|
46
44
|
return this.__isWYSIWYG(chord.keyCode);
|
|
47
45
|
}
|
|
48
46
|
__isWYSIWYG(keyCode) {
|
|
49
|
-
if (keyCode ===
|
|
50
|
-
|| keyCode ===
|
|
51
|
-
|| keyCode ===
|
|
52
|
-
|| keyCode ===
|
|
47
|
+
if (keyCode === 15
|
|
48
|
+
|| keyCode === 16
|
|
49
|
+
|| keyCode === 17
|
|
50
|
+
|| keyCode === 18 ) {
|
|
53
51
|
return true;
|
|
54
52
|
}
|
|
55
53
|
const ariaLabel = this._mapper.getAriaLabelForKeyCode(keyCode);
|
|
@@ -77,16 +75,16 @@ class WindowsNativeResolvedKeybinding extends BaseResolvedKeybinding {
|
|
|
77
75
|
return result;
|
|
78
76
|
}
|
|
79
77
|
_getSingleModifierChordDispatch(chord) {
|
|
80
|
-
if (chord.keyCode ===
|
|
78
|
+
if (chord.keyCode === 5 && !chord.shiftKey && !chord.altKey && !chord.metaKey) {
|
|
81
79
|
return 'ctrl';
|
|
82
80
|
}
|
|
83
|
-
if (chord.keyCode ===
|
|
81
|
+
if (chord.keyCode === 4 && !chord.ctrlKey && !chord.altKey && !chord.metaKey) {
|
|
84
82
|
return 'shift';
|
|
85
83
|
}
|
|
86
|
-
if (chord.keyCode ===
|
|
84
|
+
if (chord.keyCode === 6 && !chord.ctrlKey && !chord.shiftKey && !chord.metaKey) {
|
|
87
85
|
return 'alt';
|
|
88
86
|
}
|
|
89
|
-
if (chord.keyCode ===
|
|
87
|
+
if (chord.keyCode === 57 && !chord.ctrlKey && !chord.shiftKey && !chord.altKey) {
|
|
90
88
|
return 'meta';
|
|
91
89
|
}
|
|
92
90
|
return null;
|
|
@@ -122,10 +120,10 @@ class WindowsKeyboardMapper {
|
|
|
122
120
|
this._scanCodeToKeyCode = [];
|
|
123
121
|
this._keyCodeToLabel = [];
|
|
124
122
|
this._keyCodeExists = [];
|
|
125
|
-
this._keyCodeToLabel[
|
|
126
|
-
for (let scanCode =
|
|
123
|
+
this._keyCodeToLabel[0 ] = ( KeyCodeUtils.toString(0 ));
|
|
124
|
+
for (let scanCode = 0 ; scanCode < 193 ; scanCode++) {
|
|
127
125
|
const immutableKeyCode = IMMUTABLE_CODE_TO_KEY_CODE[scanCode];
|
|
128
|
-
if (immutableKeyCode !==
|
|
126
|
+
if (immutableKeyCode !== -1 ) {
|
|
129
127
|
this._scanCodeToKeyCode[scanCode] = immutableKeyCode;
|
|
130
128
|
this._keyCodeToLabel[immutableKeyCode] = ( KeyCodeUtils.toString(immutableKeyCode));
|
|
131
129
|
this._keyCodeExists[immutableKeyCode] = true;
|
|
@@ -137,17 +135,17 @@ class WindowsKeyboardMapper {
|
|
|
137
135
|
for (const strCode in rawMappings) {
|
|
138
136
|
if (rawMappings.hasOwnProperty(strCode)) {
|
|
139
137
|
const scanCode = ScanCodeUtils.toEnum(strCode);
|
|
140
|
-
if (scanCode ===
|
|
138
|
+
if (scanCode === 0 ) {
|
|
141
139
|
continue;
|
|
142
140
|
}
|
|
143
141
|
const rawMapping = rawMappings[strCode];
|
|
144
142
|
const immutableKeyCode = IMMUTABLE_CODE_TO_KEY_CODE[scanCode];
|
|
145
|
-
if (immutableKeyCode !==
|
|
146
|
-
const keyCode = NATIVE_WINDOWS_KEY_CODE_TO_KEY_CODE[rawMapping.vkey] ||
|
|
147
|
-
if (keyCode ===
|
|
143
|
+
if (immutableKeyCode !== -1 ) {
|
|
144
|
+
const keyCode = NATIVE_WINDOWS_KEY_CODE_TO_KEY_CODE[rawMapping.vkey] || 0 ;
|
|
145
|
+
if (keyCode === 0 || immutableKeyCode === keyCode) {
|
|
148
146
|
continue;
|
|
149
147
|
}
|
|
150
|
-
if (scanCode !==
|
|
148
|
+
if (scanCode !== 134 ) {
|
|
151
149
|
continue;
|
|
152
150
|
}
|
|
153
151
|
}
|
|
@@ -155,7 +153,7 @@ class WindowsKeyboardMapper {
|
|
|
155
153
|
const withShift = rawMapping.withShift;
|
|
156
154
|
const withAltGr = rawMapping.withAltGr;
|
|
157
155
|
const withShiftAltGr = rawMapping.withShiftAltGr;
|
|
158
|
-
const keyCode = NATIVE_WINDOWS_KEY_CODE_TO_KEY_CODE[rawMapping.vkey] ||
|
|
156
|
+
const keyCode = NATIVE_WINDOWS_KEY_CODE_TO_KEY_CODE[rawMapping.vkey] || 0 ;
|
|
159
157
|
const mapping = {
|
|
160
158
|
scanCode: scanCode,
|
|
161
159
|
keyCode: keyCode,
|
|
@@ -166,7 +164,7 @@ class WindowsKeyboardMapper {
|
|
|
166
164
|
};
|
|
167
165
|
this._codeInfo[scanCode] = mapping;
|
|
168
166
|
this._scanCodeToKeyCode[scanCode] = keyCode;
|
|
169
|
-
if (keyCode ===
|
|
167
|
+
if (keyCode === 0 ) {
|
|
170
168
|
continue;
|
|
171
169
|
}
|
|
172
170
|
this._keyCodeExists[keyCode] = true;
|
|
@@ -178,13 +176,13 @@ class WindowsKeyboardMapper {
|
|
|
178
176
|
}
|
|
179
177
|
else {
|
|
180
178
|
const charCode = value.charCodeAt(0);
|
|
181
|
-
if (charCode >=
|
|
182
|
-
const upperCaseValue =
|
|
179
|
+
if (charCode >= 97 && charCode <= 122 ) {
|
|
180
|
+
const upperCaseValue = 65 + ((charCode - 97) );
|
|
183
181
|
producesLetter[upperCaseValue] = true;
|
|
184
182
|
producesLetters = true;
|
|
185
|
-
this._keyCodeToLabel[keyCode] = String.fromCharCode(
|
|
183
|
+
this._keyCodeToLabel[keyCode] = String.fromCharCode(65 + ((charCode - 97) ));
|
|
186
184
|
}
|
|
187
|
-
else if (charCode >=
|
|
185
|
+
else if (charCode >= 65 && charCode <= 90 ) {
|
|
188
186
|
producesLetter[charCode] = true;
|
|
189
187
|
producesLetters = true;
|
|
190
188
|
this._keyCodeToLabel[keyCode] = value;
|
|
@@ -200,59 +198,59 @@ class WindowsKeyboardMapper {
|
|
|
200
198
|
this._keyCodeToLabel[keyCode] = String.fromCharCode(charCode);
|
|
201
199
|
}
|
|
202
200
|
};
|
|
203
|
-
_registerLetterIfMissing(
|
|
204
|
-
_registerLetterIfMissing(
|
|
205
|
-
_registerLetterIfMissing(
|
|
206
|
-
_registerLetterIfMissing(
|
|
207
|
-
_registerLetterIfMissing(
|
|
208
|
-
_registerLetterIfMissing(
|
|
209
|
-
_registerLetterIfMissing(
|
|
210
|
-
_registerLetterIfMissing(
|
|
211
|
-
_registerLetterIfMissing(
|
|
212
|
-
_registerLetterIfMissing(
|
|
213
|
-
_registerLetterIfMissing(
|
|
214
|
-
_registerLetterIfMissing(
|
|
215
|
-
_registerLetterIfMissing(
|
|
216
|
-
_registerLetterIfMissing(
|
|
217
|
-
_registerLetterIfMissing(
|
|
218
|
-
_registerLetterIfMissing(
|
|
219
|
-
_registerLetterIfMissing(
|
|
220
|
-
_registerLetterIfMissing(
|
|
221
|
-
_registerLetterIfMissing(
|
|
222
|
-
_registerLetterIfMissing(
|
|
223
|
-
_registerLetterIfMissing(
|
|
224
|
-
_registerLetterIfMissing(
|
|
225
|
-
_registerLetterIfMissing(
|
|
226
|
-
_registerLetterIfMissing(
|
|
227
|
-
_registerLetterIfMissing(
|
|
228
|
-
_registerLetterIfMissing(
|
|
201
|
+
_registerLetterIfMissing(65 , 31 );
|
|
202
|
+
_registerLetterIfMissing(66 , 32 );
|
|
203
|
+
_registerLetterIfMissing(67 , 33 );
|
|
204
|
+
_registerLetterIfMissing(68 , 34 );
|
|
205
|
+
_registerLetterIfMissing(69 , 35 );
|
|
206
|
+
_registerLetterIfMissing(70 , 36 );
|
|
207
|
+
_registerLetterIfMissing(71 , 37 );
|
|
208
|
+
_registerLetterIfMissing(72 , 38 );
|
|
209
|
+
_registerLetterIfMissing(73 , 39 );
|
|
210
|
+
_registerLetterIfMissing(74 , 40 );
|
|
211
|
+
_registerLetterIfMissing(75 , 41 );
|
|
212
|
+
_registerLetterIfMissing(76 , 42 );
|
|
213
|
+
_registerLetterIfMissing(77 , 43 );
|
|
214
|
+
_registerLetterIfMissing(78 , 44 );
|
|
215
|
+
_registerLetterIfMissing(79 , 45 );
|
|
216
|
+
_registerLetterIfMissing(80 , 46 );
|
|
217
|
+
_registerLetterIfMissing(81 , 47 );
|
|
218
|
+
_registerLetterIfMissing(82 , 48 );
|
|
219
|
+
_registerLetterIfMissing(83 , 49 );
|
|
220
|
+
_registerLetterIfMissing(84 , 50 );
|
|
221
|
+
_registerLetterIfMissing(85 , 51 );
|
|
222
|
+
_registerLetterIfMissing(86 , 52 );
|
|
223
|
+
_registerLetterIfMissing(87 , 53 );
|
|
224
|
+
_registerLetterIfMissing(88 , 54 );
|
|
225
|
+
_registerLetterIfMissing(89 , 55 );
|
|
226
|
+
_registerLetterIfMissing(90 , 56 );
|
|
229
227
|
if (!producesLetters) {
|
|
230
228
|
const _registerLabel = (keyCode, charCode) => {
|
|
231
229
|
this._keyCodeToLabel[keyCode] = String.fromCharCode(charCode);
|
|
232
230
|
};
|
|
233
|
-
_registerLabel(
|
|
234
|
-
_registerLabel(
|
|
235
|
-
_registerLabel(
|
|
236
|
-
_registerLabel(
|
|
237
|
-
_registerLabel(
|
|
238
|
-
_registerLabel(
|
|
239
|
-
_registerLabel(
|
|
240
|
-
_registerLabel(
|
|
241
|
-
_registerLabel(
|
|
242
|
-
_registerLabel(
|
|
243
|
-
_registerLabel(
|
|
231
|
+
_registerLabel(85 , 59 );
|
|
232
|
+
_registerLabel(86 , 61 );
|
|
233
|
+
_registerLabel(87 , 44 );
|
|
234
|
+
_registerLabel(88 , 45 );
|
|
235
|
+
_registerLabel(89 , 46 );
|
|
236
|
+
_registerLabel(90 , 47 );
|
|
237
|
+
_registerLabel(91 , 96 );
|
|
238
|
+
_registerLabel(92 , 91 );
|
|
239
|
+
_registerLabel(93 , 92 );
|
|
240
|
+
_registerLabel(94 , 93 );
|
|
241
|
+
_registerLabel(95 , 39 );
|
|
244
242
|
}
|
|
245
243
|
}
|
|
246
244
|
dumpDebugInfo() {
|
|
247
245
|
const result = [];
|
|
248
246
|
const immutableSamples = [
|
|
249
|
-
|
|
250
|
-
|
|
247
|
+
88 ,
|
|
248
|
+
104
|
|
251
249
|
];
|
|
252
250
|
let cnt = 0;
|
|
253
251
|
result.push(`-----------------------------------------------------------------------------------------------------------------------------------------`);
|
|
254
|
-
for (let scanCode =
|
|
255
|
-
if (IMMUTABLE_CODE_TO_KEY_CODE[scanCode] !==
|
|
252
|
+
for (let scanCode = 0 ; scanCode < 193 ; scanCode++) {
|
|
253
|
+
if (IMMUTABLE_CODE_TO_KEY_CODE[scanCode] !== -1 ) {
|
|
256
254
|
if (immutableSamples.indexOf(scanCode) === -1) {
|
|
257
255
|
continue;
|
|
258
256
|
}
|
|
@@ -312,7 +310,7 @@ class WindowsKeyboardMapper {
|
|
|
312
310
|
return KeyCodeUtils.toElectronAccelerator(chord.keyCode);
|
|
313
311
|
}
|
|
314
312
|
_getLabelForKeyCode(keyCode) {
|
|
315
|
-
return this._keyCodeToLabel[keyCode] || ( KeyCodeUtils.toString(
|
|
313
|
+
return this._keyCodeToLabel[keyCode] || ( KeyCodeUtils.toString(0 ));
|
|
316
314
|
}
|
|
317
315
|
resolveKeyboardEvent(keyboardEvent) {
|
|
318
316
|
const ctrlKey = keyboardEvent.ctrlKey || (this._mapAltGrToCtrlAlt && keyboardEvent.altGraphKey);
|
|
@@ -336,8 +334,8 @@ class WindowsKeyboardMapper {
|
|
|
336
334
|
}
|
|
337
335
|
return chord;
|
|
338
336
|
}
|
|
339
|
-
const keyCode = this._scanCodeToKeyCode[chord.scanCode] ||
|
|
340
|
-
if (keyCode ===
|
|
337
|
+
const keyCode = this._scanCodeToKeyCode[chord.scanCode] || 0 ;
|
|
338
|
+
if (keyCode === 0 || !this._keyCodeExists[keyCode]) {
|
|
341
339
|
return null;
|
|
342
340
|
}
|
|
343
341
|
return ( new KeyCodeChord(chord.ctrlKey, chord.shiftKey, chord.altKey, chord.metaKey, keyCode));
|