@codingame/monaco-vscode-keybindings-service-override 25.1.2 → 26.0.1

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.
@@ -14,22 +14,26 @@ class WindowsNativeResolvedKeybinding extends BaseResolvedKeybinding {
14
14
  }
15
15
  _getLabel(chord) {
16
16
  if (chord.isDuplicateModifierCase()) {
17
- return '';
17
+ return "";
18
18
  }
19
19
  return this._mapper.getUILabelForKeyCode(chord.keyCode);
20
20
  }
21
21
  _getUSLabelForKeybinding(chord) {
22
22
  if (chord.isDuplicateModifierCase()) {
23
- return '';
23
+ return "";
24
24
  }
25
25
  return ( KeyCodeUtils.toString(chord.keyCode));
26
26
  }
27
27
  getUSLabel() {
28
- return UILabelProvider.toLabel(this._os, this._chords, (keybinding) => this._getUSLabelForKeybinding(keybinding));
28
+ return UILabelProvider.toLabel(
29
+ this._os,
30
+ this._chords,
31
+ keybinding => this._getUSLabelForKeybinding(keybinding)
32
+ );
29
33
  }
30
34
  _getAriaLabel(chord) {
31
35
  if (chord.isDuplicateModifierCase()) {
32
- return '';
36
+ return "";
33
37
  }
34
38
  return this._mapper.getAriaLabelForKeyCode(chord.keyCode);
35
39
  }
@@ -38,7 +42,7 @@ class WindowsNativeResolvedKeybinding extends BaseResolvedKeybinding {
38
42
  }
39
43
  _getUserSettingsLabel(chord) {
40
44
  if (chord.isDuplicateModifierCase()) {
41
- return '';
45
+ return "";
42
46
  }
43
47
  const result = this._mapper.getUserSettingsLabelForKeyCode(chord.keyCode);
44
48
  return (result ? result.toLowerCase() : result);
@@ -47,10 +51,7 @@ class WindowsNativeResolvedKeybinding extends BaseResolvedKeybinding {
47
51
  return this.__isWYSIWYG(chord.keyCode);
48
52
  }
49
53
  __isWYSIWYG(keyCode) {
50
- if (keyCode === KeyCode.LeftArrow
51
- || keyCode === KeyCode.UpArrow
52
- || keyCode === KeyCode.RightArrow
53
- || keyCode === KeyCode.DownArrow) {
54
+ if (keyCode === KeyCode.LeftArrow || keyCode === KeyCode.UpArrow || keyCode === KeyCode.RightArrow || keyCode === KeyCode.DownArrow) {
54
55
  return true;
55
56
  }
56
57
  const ariaLabel = this._mapper.getAriaLabelForKeyCode(keyCode);
@@ -61,34 +62,34 @@ class WindowsNativeResolvedKeybinding extends BaseResolvedKeybinding {
61
62
  if (chord.isModifierKey()) {
62
63
  return null;
63
64
  }
64
- let result = '';
65
+ let result = "";
65
66
  if (chord.ctrlKey) {
66
- result += 'ctrl+';
67
+ result += "ctrl+";
67
68
  }
68
69
  if (chord.shiftKey) {
69
- result += 'shift+';
70
+ result += "shift+";
70
71
  }
71
72
  if (chord.altKey) {
72
- result += 'alt+';
73
+ result += "alt+";
73
74
  }
74
75
  if (chord.metaKey) {
75
- result += 'meta+';
76
+ result += "meta+";
76
77
  }
77
78
  result += ( KeyCodeUtils.toString(chord.keyCode));
78
79
  return result;
79
80
  }
80
81
  _getSingleModifierChordDispatch(chord) {
81
82
  if (chord.keyCode === KeyCode.Ctrl && !chord.shiftKey && !chord.altKey && !chord.metaKey) {
82
- return 'ctrl';
83
+ return "ctrl";
83
84
  }
84
85
  if (chord.keyCode === KeyCode.Shift && !chord.ctrlKey && !chord.altKey && !chord.metaKey) {
85
- return 'shift';
86
+ return "shift";
86
87
  }
87
88
  if (chord.keyCode === KeyCode.Alt && !chord.ctrlKey && !chord.shiftKey && !chord.metaKey) {
88
- return 'alt';
89
+ return "alt";
89
90
  }
90
91
  if (chord.keyCode === KeyCode.Meta && !chord.ctrlKey && !chord.shiftKey && !chord.altKey) {
91
- return 'meta';
92
+ return "meta";
92
93
  }
93
94
  return null;
94
95
  }
@@ -110,9 +111,9 @@ class WindowsNativeResolvedKeybinding extends BaseResolvedKeybinding {
110
111
  static getProducedChar(chord, mapping) {
111
112
  const char = this.getProducedCharCode(chord, mapping);
112
113
  if (char === null || char.length === 0) {
113
- return ' --- ';
114
+ return " --- ";
114
115
  }
115
- return ' ' + char + ' ';
116
+ return " " + char + " ";
116
117
  }
117
118
  }
118
119
  class WindowsKeyboardMapper {
@@ -163,7 +164,7 @@ class WindowsKeyboardMapper {
163
164
  value: value,
164
165
  withShift: withShift,
165
166
  withAltGr: withAltGr,
166
- withShiftAltGr: withShiftAltGr,
167
+ withShiftAltGr: withShiftAltGr
167
168
  };
168
169
  this._codeInfo[scanCode] = mapping;
169
170
  this._scanCodeToKeyCode[scanCode] = keyCode;
@@ -173,24 +174,20 @@ class WindowsKeyboardMapper {
173
174
  this._keyCodeExists[keyCode] = true;
174
175
  if (value.length === 0) {
175
176
  this._keyCodeToLabel[keyCode] = null;
176
- }
177
- else if (value.length > 1) {
177
+ } else if (value.length > 1) {
178
178
  this._keyCodeToLabel[keyCode] = value;
179
- }
180
- else {
179
+ } else {
181
180
  const charCode = value.charCodeAt(0);
182
181
  if (charCode >= CharCode.a && charCode <= CharCode.z) {
183
182
  const upperCaseValue = CharCode.A + (charCode - CharCode.a);
184
183
  producesLetter[upperCaseValue] = true;
185
184
  producesLetters = true;
186
185
  this._keyCodeToLabel[keyCode] = String.fromCharCode(CharCode.A + (charCode - CharCode.a));
187
- }
188
- else if (charCode >= CharCode.A && charCode <= CharCode.Z) {
186
+ } else if (charCode >= CharCode.A && charCode <= CharCode.Z) {
189
187
  producesLetter[charCode] = true;
190
188
  producesLetters = true;
191
189
  this._keyCodeToLabel[keyCode] = value;
192
- }
193
- else {
190
+ } else {
194
191
  this._keyCodeToLabel[keyCode] = value;
195
192
  }
196
193
  }
@@ -246,12 +243,11 @@ class WindowsKeyboardMapper {
246
243
  }
247
244
  dumpDebugInfo() {
248
245
  const result = [];
249
- const immutableSamples = [
250
- ScanCode.ArrowUp,
251
- ScanCode.Numpad0
252
- ];
246
+ const immutableSamples = [ScanCode.ArrowUp, ScanCode.Numpad0];
253
247
  let cnt = 0;
254
- result.push(`-----------------------------------------------------------------------------------------------------------------------------------------`);
248
+ result.push(
249
+ `-----------------------------------------------------------------------------------------------------------------------------------------`
250
+ );
255
251
  for (let scanCode = ScanCode.None; scanCode < ScanCode.MAX_VALUE; scanCode++) {
256
252
  if (IMMUTABLE_CODE_TO_KEY_CODE[scanCode] !== KeyCode.DependsOnKbLayout) {
257
253
  if (immutableSamples.indexOf(scanCode) === -1) {
@@ -259,8 +255,12 @@ class WindowsKeyboardMapper {
259
255
  }
260
256
  }
261
257
  if (cnt % 6 === 0) {
262
- result.push(`| HW Code combination | Key | KeyCode combination | UI label | User settings | WYSIWYG |`);
263
- result.push(`-----------------------------------------------------------------------------------------------------------------------------------------`);
258
+ result.push(
259
+ `| HW Code combination | Key | KeyCode combination | UI label | User settings | WYSIWYG |`
260
+ );
261
+ result.push(
262
+ `-----------------------------------------------------------------------------------------------------------------------------------------`
263
+ );
264
264
  }
265
265
  cnt++;
266
266
  const mapping = this._codeInfo[scanCode];
@@ -274,26 +274,30 @@ class WindowsKeyboardMapper {
274
274
  const keyCodeChord = this._resolveChord(scanCodeChord);
275
275
  const strKeyCode = (keyCodeChord ? ( KeyCodeUtils.toString(keyCodeChord.keyCode)) : null);
276
276
  const resolvedKb = (keyCodeChord ? ( new WindowsNativeResolvedKeybinding(this, [keyCodeChord])) : null);
277
- const outScanCode = `${ctrlKey ? 'Ctrl+' : ''}${shiftKey ? 'Shift+' : ''}${altKey ? 'Alt+' : ''}${strCode}`;
277
+ const outScanCode = `${ctrlKey ? "Ctrl+" : ""}${shiftKey ? "Shift+" : ""}${altKey ? "Alt+" : ""}${strCode}`;
278
278
  const ariaLabel = (resolvedKb ? resolvedKb.getAriaLabel() : null);
279
- const outUILabel = (ariaLabel ? ariaLabel.replace(/Control\+/, 'Ctrl+') : null);
279
+ const outUILabel = (ariaLabel ? ariaLabel.replace(/Control\+/, "Ctrl+") : null);
280
280
  const outUserSettings = (resolvedKb ? resolvedKb.getUserSettingsLabel() : null);
281
281
  const outKey = WindowsNativeResolvedKeybinding.getProducedChar(scanCodeChord, mapping);
282
- const outKb = (strKeyCode ? `${ctrlKey ? 'Ctrl+' : ''}${shiftKey ? 'Shift+' : ''}${altKey ? 'Alt+' : ''}${strKeyCode}` : null);
282
+ const outKb = (strKeyCode ? `${ctrlKey ? "Ctrl+" : ""}${shiftKey ? "Shift+" : ""}${altKey ? "Alt+" : ""}${strKeyCode}` : null);
283
283
  const isWYSIWYG = (resolvedKb ? resolvedKb.isWYSIWYG() : false);
284
- const outWYSIWYG = (isWYSIWYG ? ' ' : ' NO ');
285
- result.push(`| ${this._leftPad(outScanCode, 30)} | ${outKey} | ${this._leftPad(outKb, 25)} | ${this._leftPad(outUILabel, 25)} | ${this._leftPad(outUserSettings, 25)} | ${outWYSIWYG} |`);
284
+ const outWYSIWYG = (isWYSIWYG ? " " : " NO ");
285
+ result.push(
286
+ `| ${this._leftPad(outScanCode, 30)} | ${outKey} | ${this._leftPad(outKb, 25)} | ${this._leftPad(outUILabel, 25)} | ${this._leftPad(outUserSettings, 25)} | ${outWYSIWYG} |`
287
+ );
286
288
  }
287
- result.push(`-----------------------------------------------------------------------------------------------------------------------------------------`);
289
+ result.push(
290
+ `-----------------------------------------------------------------------------------------------------------------------------------------`
291
+ );
288
292
  }
289
- return result.join('\n');
293
+ return result.join("\n");
290
294
  }
291
295
  _leftPad(str, cnt) {
292
296
  if (str === null) {
293
- str = 'null';
297
+ str = "null";
294
298
  }
295
299
  while (str.length < cnt) {
296
- str = ' ' + str;
300
+ str = " " + str;
297
301
  }
298
302
  return str;
299
303
  }