@codingame/monaco-vscode-api 1.76.2 → 1.76.3-next.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/README.md +2 -1
- package/dist/api.js +3 -860
- package/dist/{extHost.js → api2.js} +16555 -13467
- package/dist/async.js +107 -2
- package/dist/audioCue.js +105 -103
- package/dist/button.js +1 -1
- package/dist/cancellation.js +3 -0
- package/dist/configuration.js +7 -344
- package/dist/configuration2.js +339 -0
- package/dist/configurationRegistry.js +441 -0
- package/dist/contextkeys.js +211 -0
- package/dist/debug.d.ts +22 -0
- package/dist/debug.js +15842 -0
- package/dist/dialogs.js +855 -9
- package/dist/extensionResourceLoader.js +96 -0
- package/dist/extensions.d.ts +491 -0
- package/dist/extensions.js +70 -0
- package/dist/{tools.js → extensionsRegistry.js} +2 -30
- package/dist/files.js +1407 -334
- package/dist/iconv.js +43 -0
- package/dist/injection.js +1 -1
- package/dist/jschardet.js +7 -0
- package/dist/keybindings.d.ts +1 -485
- package/dist/keybindings.js +666 -679
- package/dist/labels.js +14 -0
- package/dist/languageConfiguration.d.ts +1 -2
- package/dist/languageConfiguration.js +9 -16
- package/dist/languageService.js +112 -8
- package/dist/languages.d.ts +1 -473
- package/dist/languages.js +2 -12
- package/dist/layout.js +4 -3
- package/dist/layoutService.js +1 -1
- package/dist/missing-services.js +4710 -74
- package/dist/modelEditor.d.ts +324 -2
- package/dist/modelEditor.js +15 -228
- package/dist/monaco.js +7 -72
- package/dist/notifications.js +75 -232
- package/dist/polyfill.js +10715 -2459
- package/dist/resources.js +197 -0
- package/dist/services.d.ts +924 -3
- package/dist/services.js +1 -2
- package/dist/services2.js +2436 -18
- package/dist/snippets.d.ts +1 -473
- package/dist/snippets.js +8 -867
- package/dist/snippetsService.js +868 -0
- package/dist/textFileEditorModel.js +2985 -0
- package/dist/textmate.d.ts +3 -475
- package/dist/textmate.js +19 -29
- package/dist/theme.d.ts +1 -3
- package/dist/theme.js +24 -70
- package/dist/tokenClassification.d.ts +1 -475
- package/dist/tokenClassification.js +11 -37
- package/dist/tokenClassificationRegistry.js +8 -4
- package/dist/variableResolver.js +1711 -0
- package/dist/workbenchThemeService.js +1 -1
- package/dist/workspaceContext.js +1 -3
- package/package.json +27 -12
- package/dist/contextkey.js +0 -419
- package/dist/dialog.web.contribution.js +0 -945
package/dist/keybindings.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { _ as __decorate, a as __param, E as Emitter } from './
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { _ as __decorate, a as __param, J as IUserDataProfilesService, n as IFileService, I as IEditorService, d as IEditorGroupsService, e as IProductService, E as Emitter, t as IHostService } from './services2.js';
|
|
2
|
+
import { h as index, p as parse, j as getNodeType, f as flatten } from './polyfill.js';
|
|
3
|
+
import { q as isProposedApiEnabled, bR as IKeyboardLayoutService, bp as IExtensionService, bS as IPreferencesService, bT as getKeyboardLayoutId, bU as IUserDataProfileService, bV as FallbackKeyboardMapper } from './missing-services.js';
|
|
4
4
|
import { KeyCodeChord, ScanCodeChord, Keybinding } from 'monaco-editor/esm/vs/base/common/keybindings.js';
|
|
5
5
|
import { KeyCodeUtils, IMMUTABLE_CODE_TO_KEY_CODE, NATIVE_WINDOWS_KEY_CODE_TO_KEY_CODE, IMMUTABLE_KEY_CODE_TO_CODE } from 'monaco-editor/esm/vs/base/common/keyCodes.js';
|
|
6
|
-
import {
|
|
6
|
+
import { E as ExtensionsRegistry } from './extensionsRegistry.js';
|
|
7
7
|
import { ContextKeyExpr, IContextKeyService } from 'monaco-editor/esm/vs/platform/contextkey/common/contextkey.js';
|
|
8
|
-
import { S as Services, r as IUserDataProfilesService, c as IFileService, b as IEditorService, I as IEditorGroupsService, h as IProductService, d as IHostService } from './services2.js';
|
|
9
8
|
import { getConfiguredDefaultLocale, localize } from 'monaco-editor/esm/vs/nls.js';
|
|
10
9
|
import { ThemeIcon } from 'monaco-editor/esm/vs/base/common/themables.js';
|
|
11
10
|
import { joinPath, dirname } from 'monaco-editor/esm/vs/base/common/resources.js';
|
|
@@ -49,7 +48,6 @@ import { IEnvironmentService } from 'monaco-editor/esm/vs/platform/environment/c
|
|
|
49
48
|
import { IStorageService } from 'monaco-editor/esm/vs/platform/storage/common/storage.js';
|
|
50
49
|
import { g as getServiceOverride$1 } from './files.js';
|
|
51
50
|
import getServiceOverride$2, { configurationRegistry as configurationRegistry$2 } from './configuration.js';
|
|
52
|
-
import { bj as DEFAULT_EXTENSION } from './extHost.js';
|
|
53
51
|
import { c as createInjectedClass } from './injection.js';
|
|
54
52
|
import { StandaloneCommandsQuickAccessProvider } from 'monaco-editor/esm/vs/editor/standalone/browser/quickAccess/standaloneCommandsQuickAccess.js';
|
|
55
53
|
import { SyncDescriptor } from 'monaco-editor/esm/vs/platform/instantiation/common/descriptors.js';
|
|
@@ -141,7 +139,8 @@ if (typeof navigator === 'object' && !isElectronRenderer) {
|
|
|
141
139
|
_userAgent.indexOf('Linux') >= 0;
|
|
142
140
|
_userAgent?.indexOf('Mobi') >= 0;
|
|
143
141
|
const configuredLocale = getConfiguredDefaultLocale(
|
|
144
|
-
(
|
|
142
|
+
(
|
|
143
|
+
(localize({ key: 'ensureLoaderPluginIsLoaded', comment: ['{Locked}'] }, '_'))));
|
|
145
144
|
_locale = configuredLocale || LANGUAGE_DEFAULT;
|
|
146
145
|
_language = _locale;
|
|
147
146
|
}
|
|
@@ -538,6 +537,151 @@ function printStandardKeyboardEvent(e) {
|
|
|
538
537
|
}
|
|
539
538
|
return `modifiers: [${modifiers.join(',')}], code: ${e.code}, keyCode: ${e.keyCode} ('${( ( KeyCodeUtils.toString(e.keyCode)))}')`;
|
|
540
539
|
}
|
|
540
|
+
class KeybindingParser {
|
|
541
|
+
static _readModifiers(input) {
|
|
542
|
+
input = input.toLowerCase().trim();
|
|
543
|
+
let ctrl = false;
|
|
544
|
+
let shift = false;
|
|
545
|
+
let alt = false;
|
|
546
|
+
let meta = false;
|
|
547
|
+
let matchedModifier;
|
|
548
|
+
do {
|
|
549
|
+
matchedModifier = false;
|
|
550
|
+
if (/^ctrl(\+|\-)/.test(input)) {
|
|
551
|
+
ctrl = true;
|
|
552
|
+
input = input.substr('ctrl-'.length);
|
|
553
|
+
matchedModifier = true;
|
|
554
|
+
}
|
|
555
|
+
if (/^shift(\+|\-)/.test(input)) {
|
|
556
|
+
shift = true;
|
|
557
|
+
input = input.substr('shift-'.length);
|
|
558
|
+
matchedModifier = true;
|
|
559
|
+
}
|
|
560
|
+
if (/^alt(\+|\-)/.test(input)) {
|
|
561
|
+
alt = true;
|
|
562
|
+
input = input.substr('alt-'.length);
|
|
563
|
+
matchedModifier = true;
|
|
564
|
+
}
|
|
565
|
+
if (/^meta(\+|\-)/.test(input)) {
|
|
566
|
+
meta = true;
|
|
567
|
+
input = input.substr('meta-'.length);
|
|
568
|
+
matchedModifier = true;
|
|
569
|
+
}
|
|
570
|
+
if (/^win(\+|\-)/.test(input)) {
|
|
571
|
+
meta = true;
|
|
572
|
+
input = input.substr('win-'.length);
|
|
573
|
+
matchedModifier = true;
|
|
574
|
+
}
|
|
575
|
+
if (/^cmd(\+|\-)/.test(input)) {
|
|
576
|
+
meta = true;
|
|
577
|
+
input = input.substr('cmd-'.length);
|
|
578
|
+
matchedModifier = true;
|
|
579
|
+
}
|
|
580
|
+
} while (matchedModifier);
|
|
581
|
+
let key;
|
|
582
|
+
const firstSpaceIdx = input.indexOf(' ');
|
|
583
|
+
if (firstSpaceIdx > 0) {
|
|
584
|
+
key = input.substring(0, firstSpaceIdx);
|
|
585
|
+
input = input.substring(firstSpaceIdx);
|
|
586
|
+
}
|
|
587
|
+
else {
|
|
588
|
+
key = input;
|
|
589
|
+
input = '';
|
|
590
|
+
}
|
|
591
|
+
return {
|
|
592
|
+
remains: input,
|
|
593
|
+
ctrl,
|
|
594
|
+
shift,
|
|
595
|
+
alt,
|
|
596
|
+
meta,
|
|
597
|
+
key
|
|
598
|
+
};
|
|
599
|
+
}
|
|
600
|
+
static parseChord(input) {
|
|
601
|
+
const mods = this._readModifiers(input);
|
|
602
|
+
const scanCodeMatch = mods.key.match(/^\[([^\]]+)\]$/);
|
|
603
|
+
if (scanCodeMatch) {
|
|
604
|
+
const strScanCode = scanCodeMatch[1];
|
|
605
|
+
const scanCode = ScanCodeUtils.lowerCaseToEnum(strScanCode);
|
|
606
|
+
return [( (new ScanCodeChord(mods.ctrl, mods.shift, mods.alt, mods.meta, scanCode))), mods.remains];
|
|
607
|
+
}
|
|
608
|
+
const keyCode = KeyCodeUtils.fromUserSettings(mods.key);
|
|
609
|
+
return [( (new KeyCodeChord(mods.ctrl, mods.shift, mods.alt, mods.meta, keyCode))), mods.remains];
|
|
610
|
+
}
|
|
611
|
+
static parseKeybinding(input) {
|
|
612
|
+
if (!input) {
|
|
613
|
+
return null;
|
|
614
|
+
}
|
|
615
|
+
const chords = [];
|
|
616
|
+
let chord;
|
|
617
|
+
while (input.length > 0) {
|
|
618
|
+
[chord, input] = this.parseChord(input);
|
|
619
|
+
chords.push(chord);
|
|
620
|
+
}
|
|
621
|
+
return (chords.length > 0 ? (new Keybinding(chords)) : null);
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
class KeybindingIO {
|
|
625
|
+
static writeKeybindingItem(out, item) {
|
|
626
|
+
if (!item.resolvedKeybinding) {
|
|
627
|
+
return;
|
|
628
|
+
}
|
|
629
|
+
const quotedSerializedKeybinding = JSON.stringify(item.resolvedKeybinding.getUserSettingsLabel());
|
|
630
|
+
out.write(`{ "key": ${rightPaddedString(quotedSerializedKeybinding + ',', 25)} "command": `);
|
|
631
|
+
const quotedSerializedWhen = item.when ? JSON.stringify(item.when.serialize()) : '';
|
|
632
|
+
const quotedSerializeCommand = JSON.stringify(item.command);
|
|
633
|
+
if (quotedSerializedWhen.length > 0) {
|
|
634
|
+
out.write(`${quotedSerializeCommand},`);
|
|
635
|
+
out.writeLine();
|
|
636
|
+
out.write(` "when": ${quotedSerializedWhen}`);
|
|
637
|
+
}
|
|
638
|
+
else {
|
|
639
|
+
out.write(`${quotedSerializeCommand}`);
|
|
640
|
+
}
|
|
641
|
+
if (item.commandArgs) {
|
|
642
|
+
out.write(',');
|
|
643
|
+
out.writeLine();
|
|
644
|
+
out.write(` "args": ${JSON.stringify(item.commandArgs)}`);
|
|
645
|
+
}
|
|
646
|
+
out.write(' }');
|
|
647
|
+
}
|
|
648
|
+
static readUserKeybindingItem(input) {
|
|
649
|
+
const keybinding = (typeof input.key === 'string' ? KeybindingParser.parseKeybinding(input.key) : null);
|
|
650
|
+
const when = (typeof input.when === 'string' ? ContextKeyExpr.deserialize(input.when) : undefined);
|
|
651
|
+
const command = (typeof input.command === 'string' ? input.command : null);
|
|
652
|
+
const commandArgs = (typeof input.args !== 'undefined' ? input.args : undefined);
|
|
653
|
+
return {
|
|
654
|
+
keybinding,
|
|
655
|
+
command,
|
|
656
|
+
commandArgs,
|
|
657
|
+
when,
|
|
658
|
+
_source: input
|
|
659
|
+
};
|
|
660
|
+
}
|
|
661
|
+
}
|
|
662
|
+
function rightPaddedString(str, minChars) {
|
|
663
|
+
if (str.length < minChars) {
|
|
664
|
+
return str + (( (new Array(minChars - str.length))).join(' '));
|
|
665
|
+
}
|
|
666
|
+
return str;
|
|
667
|
+
}
|
|
668
|
+
class OutputBuilder {
|
|
669
|
+
constructor() {
|
|
670
|
+
this._lines = [];
|
|
671
|
+
this._currentLine = '';
|
|
672
|
+
}
|
|
673
|
+
write(str) {
|
|
674
|
+
this._currentLine += str;
|
|
675
|
+
}
|
|
676
|
+
writeLine(str = '') {
|
|
677
|
+
this._lines.push(this._currentLine + str);
|
|
678
|
+
this._currentLine = '';
|
|
679
|
+
}
|
|
680
|
+
toString() {
|
|
681
|
+
this.writeLine();
|
|
682
|
+
return this._lines.join('\n');
|
|
683
|
+
}
|
|
684
|
+
}
|
|
541
685
|
const apiMenus = [
|
|
542
686
|
{
|
|
543
687
|
key: 'commandPalette',
|
|
@@ -1271,7 +1415,7 @@ var schema$1;
|
|
|
1271
1415
|
};
|
|
1272
1416
|
})(schema$1 || (schema$1 = {}))));
|
|
1273
1417
|
const _commandRegistrations = ( (new DisposableStore()));
|
|
1274
|
-
const commandsExtensionPoint
|
|
1418
|
+
const commandsExtensionPoint = ( (ExtensionsRegistry.registerExtensionPoint({
|
|
1275
1419
|
extensionPoint: 'commands',
|
|
1276
1420
|
jsonSchema: schema$1.commandsContribution,
|
|
1277
1421
|
activationEventsGenerator: (contribs, result) => {
|
|
@@ -1282,7 +1426,7 @@ const commandsExtensionPoint$1 = ( (ExtensionsRegistry.registerExtensionPoint({
|
|
|
1282
1426
|
}
|
|
1283
1427
|
}
|
|
1284
1428
|
})));
|
|
1285
|
-
commandsExtensionPoint
|
|
1429
|
+
commandsExtensionPoint.setHandler(extensions => {
|
|
1286
1430
|
function handleCommand(userFriendlyCommand, extension) {
|
|
1287
1431
|
if (!schema$1.isValidCommand(userFriendlyCommand, extension.collector)) {
|
|
1288
1432
|
return;
|
|
@@ -1389,7 +1533,7 @@ submenusExtensionPoint.setHandler(extensions => {
|
|
|
1389
1533
|
}
|
|
1390
1534
|
}
|
|
1391
1535
|
});
|
|
1392
|
-
const _apiMenusByKey = ( (new Map(apiMenus.map(menu => ([menu.key, menu])))));
|
|
1536
|
+
const _apiMenusByKey = ( (new Map( (apiMenus.map(menu => ([menu.key, menu]))))));
|
|
1393
1537
|
const _menuRegistrations = ( (new DisposableStore()));
|
|
1394
1538
|
const _submenuMenuItems = ( (new Map()));
|
|
1395
1539
|
const menusExtensionPoint = ( (ExtensionsRegistry.registerExtensionPoint({
|
|
@@ -1544,174 +1688,29 @@ function getAllUnboundCommands(boundCommands) {
|
|
|
1544
1688
|
}
|
|
1545
1689
|
return unboundCommands;
|
|
1546
1690
|
}
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
let matchedModifier;
|
|
1555
|
-
do {
|
|
1556
|
-
matchedModifier = false;
|
|
1557
|
-
if (/^ctrl(\+|\-)/.test(input)) {
|
|
1558
|
-
ctrl = true;
|
|
1559
|
-
input = input.substr('ctrl-'.length);
|
|
1560
|
-
matchedModifier = true;
|
|
1561
|
-
}
|
|
1562
|
-
if (/^shift(\+|\-)/.test(input)) {
|
|
1563
|
-
shift = true;
|
|
1564
|
-
input = input.substr('shift-'.length);
|
|
1565
|
-
matchedModifier = true;
|
|
1566
|
-
}
|
|
1567
|
-
if (/^alt(\+|\-)/.test(input)) {
|
|
1568
|
-
alt = true;
|
|
1569
|
-
input = input.substr('alt-'.length);
|
|
1570
|
-
matchedModifier = true;
|
|
1571
|
-
}
|
|
1572
|
-
if (/^meta(\+|\-)/.test(input)) {
|
|
1573
|
-
meta = true;
|
|
1574
|
-
input = input.substr('meta-'.length);
|
|
1575
|
-
matchedModifier = true;
|
|
1576
|
-
}
|
|
1577
|
-
if (/^win(\+|\-)/.test(input)) {
|
|
1578
|
-
meta = true;
|
|
1579
|
-
input = input.substr('win-'.length);
|
|
1580
|
-
matchedModifier = true;
|
|
1581
|
-
}
|
|
1582
|
-
if (/^cmd(\+|\-)/.test(input)) {
|
|
1583
|
-
meta = true;
|
|
1584
|
-
input = input.substr('cmd-'.length);
|
|
1585
|
-
matchedModifier = true;
|
|
1586
|
-
}
|
|
1587
|
-
} while (matchedModifier);
|
|
1588
|
-
let key;
|
|
1589
|
-
const firstSpaceIdx = input.indexOf(' ');
|
|
1590
|
-
if (firstSpaceIdx > 0) {
|
|
1591
|
-
key = input.substring(0, firstSpaceIdx);
|
|
1592
|
-
input = input.substring(firstSpaceIdx);
|
|
1593
|
-
}
|
|
1594
|
-
else {
|
|
1595
|
-
key = input;
|
|
1596
|
-
input = '';
|
|
1597
|
-
}
|
|
1598
|
-
return {
|
|
1599
|
-
remains: input,
|
|
1600
|
-
ctrl,
|
|
1601
|
-
shift,
|
|
1602
|
-
alt,
|
|
1603
|
-
meta,
|
|
1604
|
-
key
|
|
1605
|
-
};
|
|
1691
|
+
function isContributedKeyBindingsArray(thing) {
|
|
1692
|
+
return Array.isArray(thing);
|
|
1693
|
+
}
|
|
1694
|
+
function isValidContributedKeyBinding(keyBinding, rejects) {
|
|
1695
|
+
if (!keyBinding) {
|
|
1696
|
+
rejects.push(( (localize('nonempty', "expected non-empty value."))));
|
|
1697
|
+
return false;
|
|
1606
1698
|
}
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
}
|
|
1615
|
-
const keyCode = KeyCodeUtils.fromUserSettings(mods.key);
|
|
1616
|
-
return [( (new KeyCodeChord(mods.ctrl, mods.shift, mods.alt, mods.meta, keyCode))), mods.remains];
|
|
1699
|
+
if (typeof keyBinding.command !== 'string') {
|
|
1700
|
+
rejects.push(( (localize(
|
|
1701
|
+
'requirestring',
|
|
1702
|
+
"property `{0}` is mandatory and must be of type `string`",
|
|
1703
|
+
'command'
|
|
1704
|
+
))));
|
|
1705
|
+
return false;
|
|
1617
1706
|
}
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
[chord, input] = this.parseChord(input);
|
|
1626
|
-
chords.push(chord);
|
|
1627
|
-
}
|
|
1628
|
-
return (chords.length > 0 ? (new Keybinding(chords)) : null);
|
|
1629
|
-
}
|
|
1630
|
-
}
|
|
1631
|
-
class KeybindingIO {
|
|
1632
|
-
static writeKeybindingItem(out, item) {
|
|
1633
|
-
if (!item.resolvedKeybinding) {
|
|
1634
|
-
return;
|
|
1635
|
-
}
|
|
1636
|
-
const quotedSerializedKeybinding = JSON.stringify(item.resolvedKeybinding.getUserSettingsLabel());
|
|
1637
|
-
out.write(`{ "key": ${rightPaddedString(quotedSerializedKeybinding + ',', 25)} "command": `);
|
|
1638
|
-
const quotedSerializedWhen = item.when ? JSON.stringify(item.when.serialize()) : '';
|
|
1639
|
-
const quotedSerializeCommand = JSON.stringify(item.command);
|
|
1640
|
-
if (quotedSerializedWhen.length > 0) {
|
|
1641
|
-
out.write(`${quotedSerializeCommand},`);
|
|
1642
|
-
out.writeLine();
|
|
1643
|
-
out.write(` "when": ${quotedSerializedWhen}`);
|
|
1644
|
-
}
|
|
1645
|
-
else {
|
|
1646
|
-
out.write(`${quotedSerializeCommand}`);
|
|
1647
|
-
}
|
|
1648
|
-
if (item.commandArgs) {
|
|
1649
|
-
out.write(',');
|
|
1650
|
-
out.writeLine();
|
|
1651
|
-
out.write(` "args": ${JSON.stringify(item.commandArgs)}`);
|
|
1652
|
-
}
|
|
1653
|
-
out.write(' }');
|
|
1654
|
-
}
|
|
1655
|
-
static readUserKeybindingItem(input) {
|
|
1656
|
-
const keybinding = (typeof input.key === 'string' ? KeybindingParser.parseKeybinding(input.key) : null);
|
|
1657
|
-
const when = (typeof input.when === 'string' ? ContextKeyExpr.deserialize(input.when) : undefined);
|
|
1658
|
-
const command = (typeof input.command === 'string' ? input.command : null);
|
|
1659
|
-
const commandArgs = (typeof input.args !== 'undefined' ? input.args : undefined);
|
|
1660
|
-
return {
|
|
1661
|
-
keybinding,
|
|
1662
|
-
command,
|
|
1663
|
-
commandArgs,
|
|
1664
|
-
when,
|
|
1665
|
-
_source: input
|
|
1666
|
-
};
|
|
1667
|
-
}
|
|
1668
|
-
}
|
|
1669
|
-
function rightPaddedString(str, minChars) {
|
|
1670
|
-
if (str.length < minChars) {
|
|
1671
|
-
return str + (( (new Array(minChars - str.length))).join(' '));
|
|
1672
|
-
}
|
|
1673
|
-
return str;
|
|
1674
|
-
}
|
|
1675
|
-
class OutputBuilder {
|
|
1676
|
-
constructor() {
|
|
1677
|
-
this._lines = [];
|
|
1678
|
-
this._currentLine = '';
|
|
1679
|
-
}
|
|
1680
|
-
write(str) {
|
|
1681
|
-
this._currentLine += str;
|
|
1682
|
-
}
|
|
1683
|
-
writeLine(str = '') {
|
|
1684
|
-
this._lines.push(this._currentLine + str);
|
|
1685
|
-
this._currentLine = '';
|
|
1686
|
-
}
|
|
1687
|
-
toString() {
|
|
1688
|
-
this.writeLine();
|
|
1689
|
-
return this._lines.join('\n');
|
|
1690
|
-
}
|
|
1691
|
-
}
|
|
1692
|
-
function isContributedKeyBindingsArray(thing) {
|
|
1693
|
-
return Array.isArray(thing);
|
|
1694
|
-
}
|
|
1695
|
-
function isValidContributedKeyBinding(keyBinding, rejects) {
|
|
1696
|
-
if (!keyBinding) {
|
|
1697
|
-
rejects.push(( (localize('nonempty', "expected non-empty value."))));
|
|
1698
|
-
return false;
|
|
1699
|
-
}
|
|
1700
|
-
if (typeof keyBinding.command !== 'string') {
|
|
1701
|
-
rejects.push(( (localize(
|
|
1702
|
-
'requirestring',
|
|
1703
|
-
"property `{0}` is mandatory and must be of type `string`",
|
|
1704
|
-
'command'
|
|
1705
|
-
))));
|
|
1706
|
-
return false;
|
|
1707
|
-
}
|
|
1708
|
-
if (keyBinding.key && typeof keyBinding.key !== 'string') {
|
|
1709
|
-
rejects.push(( (localize(
|
|
1710
|
-
'optstring',
|
|
1711
|
-
"property `{0}` can be omitted or must be of type `string`",
|
|
1712
|
-
'key'
|
|
1713
|
-
))));
|
|
1714
|
-
return false;
|
|
1707
|
+
if (keyBinding.key && typeof keyBinding.key !== 'string') {
|
|
1708
|
+
rejects.push(( (localize(
|
|
1709
|
+
'optstring',
|
|
1710
|
+
"property `{0}` can be omitted or must be of type `string`",
|
|
1711
|
+
'key'
|
|
1712
|
+
))));
|
|
1713
|
+
return false;
|
|
1715
1714
|
}
|
|
1716
1715
|
if (keyBinding.when && typeof keyBinding.when !== 'string') {
|
|
1717
1716
|
rejects.push(( (localize(
|
|
@@ -1803,7 +1802,7 @@ const keybindingType = {
|
|
|
1803
1802
|
};
|
|
1804
1803
|
const keybindingsExtPoint = ( (ExtensionsRegistry.registerExtensionPoint({
|
|
1805
1804
|
extensionPoint: 'keybindings',
|
|
1806
|
-
deps: [commandsExtensionPoint
|
|
1805
|
+
deps: [commandsExtensionPoint],
|
|
1807
1806
|
jsonSchema: {
|
|
1808
1807
|
description: ( (localize('vscode.extension.contributes.keybindings', "Contributes keybindings."))),
|
|
1809
1808
|
oneOf: [
|
|
@@ -1920,7 +1919,7 @@ let WorkbenchKeybindingService = class WorkbenchKeybindingService extends Abstra
|
|
|
1920
1919
|
this.updateSchema();
|
|
1921
1920
|
}
|
|
1922
1921
|
updateSchema() {
|
|
1923
|
-
updateSchema(flatten(this._contributions.map(x => x.getSchemaAdditions())));
|
|
1922
|
+
updateSchema(flatten(( (this._contributions.map(x => x.getSchemaAdditions())))));
|
|
1924
1923
|
}
|
|
1925
1924
|
_printKeybinding(keybinding) {
|
|
1926
1925
|
return UserSettingsLabelProvider.toLabel(OS, keybinding.chords, (chord) => {
|
|
@@ -1935,7 +1934,7 @@ let WorkbenchKeybindingService = class WorkbenchKeybindingService extends Abstra
|
|
|
1935
1934
|
}) || '[null]';
|
|
1936
1935
|
}
|
|
1937
1936
|
_printResolvedKeybinding(resolvedKeybinding) {
|
|
1938
|
-
return resolvedKeybinding.getDispatchChords().map(x => x || '[null]').join(' ');
|
|
1937
|
+
return ( (resolvedKeybinding.getDispatchChords().map(x => x || '[null]'))).join(' ');
|
|
1939
1938
|
}
|
|
1940
1939
|
_printResolvedKeybindings(output, input, resolvedKeybindings) {
|
|
1941
1940
|
const padLength = 35;
|
|
@@ -2339,7 +2338,7 @@ class UserKeybindings extends Disposable {
|
|
|
2339
2338
|
return false;
|
|
2340
2339
|
}
|
|
2341
2340
|
this._rawKeybindings = newKeybindings;
|
|
2342
|
-
this._keybindings = this._rawKeybindings.map((k) => KeybindingIO.readUserKeybindingItem(k));
|
|
2341
|
+
this._keybindings = ( (this._rawKeybindings.map((k) => KeybindingIO.readUserKeybindingItem(k))));
|
|
2343
2342
|
return true;
|
|
2344
2343
|
}
|
|
2345
2344
|
async readUserKeybindings() {
|
|
@@ -2465,59 +2464,353 @@ function updateSchema(additionalContributions) {
|
|
|
2465
2464
|
commandsSchemas.push(...additionalContributions);
|
|
2466
2465
|
schemaRegistry.notifySchemaChanged(schemaId);
|
|
2467
2466
|
}
|
|
2468
|
-
class
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
this.
|
|
2467
|
+
let CommandsQuickAccessProvider = class CommandsQuickAccessProvider extends AbstractEditorCommandsQuickAccessProvider {
|
|
2468
|
+
get activeTextEditorControl() { return this.editorService.activeTextEditorControl; }
|
|
2469
|
+
get defaultFilterValue() {
|
|
2470
|
+
if (this.configuration.preserveInput) {
|
|
2471
|
+
return DefaultQuickAccessFilterValue.LAST;
|
|
2472
|
+
}
|
|
2473
|
+
return undefined;
|
|
2472
2474
|
}
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2475
|
+
constructor(editorService, menuService, extensionService, instantiationService, keybindingService, commandService, telemetryService, dialogService, configurationService, editorGroupService, preferencesService, productService) {
|
|
2476
|
+
super({
|
|
2477
|
+
showAlias: !Language.isDefaultVariant(),
|
|
2478
|
+
noResultsPick: {
|
|
2479
|
+
label: ( (localize('noCommandResults', "No matching commands"))),
|
|
2480
|
+
commandId: ''
|
|
2481
|
+
}
|
|
2482
|
+
}, instantiationService, keybindingService, commandService, telemetryService, dialogService);
|
|
2483
|
+
this.editorService = editorService;
|
|
2484
|
+
this.menuService = menuService;
|
|
2485
|
+
this.extensionService = extensionService;
|
|
2486
|
+
this.configurationService = configurationService;
|
|
2487
|
+
this.editorGroupService = editorGroupService;
|
|
2488
|
+
this.preferencesService = preferencesService;
|
|
2489
|
+
this.productService = productService;
|
|
2490
|
+
this.extensionRegistrationRace = Promise.race([
|
|
2491
|
+
timeout(800),
|
|
2492
|
+
this.extensionService.whenInstalledExtensionsRegistered()
|
|
2493
|
+
]);
|
|
2494
|
+
this._register(configurationService.onDidChangeConfiguration((e) => this.updateSuggestedCommandIds(e)));
|
|
2495
|
+
this.updateSuggestedCommandIds();
|
|
2496
|
+
}
|
|
2497
|
+
get configuration() {
|
|
2498
|
+
const commandPaletteConfig = this.configurationService.getValue().workbench.commandPalette;
|
|
2499
|
+
return {
|
|
2500
|
+
preserveInput: commandPaletteConfig.preserveInput,
|
|
2501
|
+
experimental: commandPaletteConfig.experimental
|
|
2502
|
+
};
|
|
2503
|
+
}
|
|
2504
|
+
updateSuggestedCommandIds(e) {
|
|
2505
|
+
if (e && !e.affectsConfiguration('workbench.commandPalette.experimental.suggestCommands')) {
|
|
2506
|
+
return;
|
|
2476
2507
|
}
|
|
2477
|
-
|
|
2508
|
+
const config = this.configuration;
|
|
2509
|
+
const suggestedCommandIds = config.experimental.suggestCommands && this.productService.commandPaletteSuggestedCommandIds?.length
|
|
2510
|
+
? ( (new Set(this.productService.commandPaletteSuggestedCommandIds)))
|
|
2511
|
+
: undefined;
|
|
2512
|
+
this.options.suggestedCommandIds = suggestedCommandIds;
|
|
2478
2513
|
}
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2514
|
+
async getCommandPicks(token) {
|
|
2515
|
+
await this.extensionRegistrationRace;
|
|
2516
|
+
if (token.isCancellationRequested) {
|
|
2517
|
+
return [];
|
|
2482
2518
|
}
|
|
2483
2519
|
return (
|
|
2484
|
-
(
|
|
2520
|
+
([
|
|
2521
|
+
...this.getCodeEditorCommandPicks(),
|
|
2522
|
+
...this.getGlobalCommandPicks()
|
|
2523
|
+
].map(c => ({
|
|
2524
|
+
...c,
|
|
2525
|
+
buttons: [{
|
|
2526
|
+
iconClass: ThemeIcon.asClassName(Codicon.gear),
|
|
2527
|
+
tooltip: ( (localize('configure keybinding', "Configure Keybinding"))),
|
|
2528
|
+
}],
|
|
2529
|
+
trigger: () => {
|
|
2530
|
+
this.preferencesService.openGlobalKeybindingSettings(false, { query: `@command:${c.commandId}` });
|
|
2531
|
+
return TriggerAction.CLOSE_PICKER;
|
|
2532
|
+
},
|
|
2533
|
+
})))
|
|
2485
2534
|
);
|
|
2486
2535
|
}
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2536
|
+
getGlobalCommandPicks() {
|
|
2537
|
+
const globalCommandPicks = [];
|
|
2538
|
+
const scopedContextKeyService = this.editorService.activeEditorPane?.scopedContextKeyService || this.editorGroupService.activeGroup.scopedContextKeyService;
|
|
2539
|
+
const globalCommandsMenu = this.menuService.createMenu(MenuId.CommandPalette, scopedContextKeyService);
|
|
2540
|
+
const globalCommandsMenuActions = globalCommandsMenu.getActions()
|
|
2541
|
+
.reduce((r, [, actions]) => [...r, ...actions], [])
|
|
2542
|
+
.filter(action => action instanceof MenuItemAction && action.enabled);
|
|
2543
|
+
for (const action of globalCommandsMenuActions) {
|
|
2544
|
+
let label = (typeof action.item.title === 'string' ? action.item.title : action.item.title.value) || action.item.id;
|
|
2545
|
+
const category = typeof action.item.category === 'string' ? action.item.category : action.item.category?.value;
|
|
2546
|
+
if (category) {
|
|
2547
|
+
label = ( (localize('commandWithCategory', "{0}: {1}", category, label)));
|
|
2548
|
+
}
|
|
2549
|
+
const aliasLabel = typeof action.item.title !== 'string' ? action.item.title.original : undefined;
|
|
2550
|
+
const aliasCategory = (category && action.item.category && typeof action.item.category !== 'string') ? action.item.category.original : undefined;
|
|
2551
|
+
const commandAlias = (aliasLabel && category) ?
|
|
2552
|
+
aliasCategory ? `${aliasCategory}: ${aliasLabel}` : `${category}: ${aliasLabel}` :
|
|
2553
|
+
aliasLabel;
|
|
2554
|
+
globalCommandPicks.push({
|
|
2555
|
+
commandId: action.item.id,
|
|
2556
|
+
commandAlias,
|
|
2557
|
+
label: stripIcons(label)
|
|
2558
|
+
});
|
|
2493
2559
|
}
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
_getElectronAccelerator(chord) {
|
|
2497
|
-
return this._mapper.getElectronAcceleratorForKeyBinding(chord);
|
|
2560
|
+
globalCommandsMenu.dispose();
|
|
2561
|
+
return globalCommandPicks;
|
|
2498
2562
|
}
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2563
|
+
};
|
|
2564
|
+
CommandsQuickAccessProvider = ( (__decorate([
|
|
2565
|
+
( (__param(0, IEditorService))),
|
|
2566
|
+
( (__param(1, IMenuService))),
|
|
2567
|
+
( (__param(2, IExtensionService))),
|
|
2568
|
+
( (__param(3, IInstantiationService))),
|
|
2569
|
+
( (__param(4, IKeybindingService))),
|
|
2570
|
+
( (__param(5, ICommandService))),
|
|
2571
|
+
( (__param(6, ITelemetryService))),
|
|
2572
|
+
( (__param(7, IDialogService))),
|
|
2573
|
+
( (__param(8, IConfigurationService))),
|
|
2574
|
+
( (__param(9, IEditorGroupsService))),
|
|
2575
|
+
( (__param(10, IPreferencesService))),
|
|
2576
|
+
( (__param(11, IProductService)))
|
|
2577
|
+
], CommandsQuickAccessProvider)));
|
|
2578
|
+
class ShowAllCommandsAction extends Action2 {
|
|
2579
|
+
constructor() {
|
|
2580
|
+
super({
|
|
2581
|
+
id: ShowAllCommandsAction.ID,
|
|
2582
|
+
title: { value: ( (localize('showTriggerActions', "Show All Commands"))), original: 'Show All Commands' },
|
|
2583
|
+
keybinding: {
|
|
2584
|
+
weight: 200 ,
|
|
2585
|
+
when: undefined,
|
|
2586
|
+
primary: !isFirefox ? ((2048 | 1024 | 46) ) : undefined,
|
|
2587
|
+
secondary: [59 ]
|
|
2588
|
+
},
|
|
2589
|
+
f1: true
|
|
2590
|
+
});
|
|
2505
2591
|
}
|
|
2506
|
-
|
|
2507
|
-
|
|
2592
|
+
async run(accessor) {
|
|
2593
|
+
accessor.get(IQuickInputService).quickAccess.show(CommandsQuickAccessProvider.PREFIX);
|
|
2508
2594
|
}
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
2595
|
+
}
|
|
2596
|
+
ShowAllCommandsAction.ID = 'workbench.action.showCommands';
|
|
2597
|
+
function deserializeMapping(serializedMapping) {
|
|
2598
|
+
const mapping = serializedMapping;
|
|
2599
|
+
const ret = {};
|
|
2600
|
+
for (const key in mapping) {
|
|
2601
|
+
const result = mapping[key];
|
|
2602
|
+
if (result.length) {
|
|
2603
|
+
const value = result[0];
|
|
2604
|
+
const withShift = result[1];
|
|
2605
|
+
const withAltGr = result[2];
|
|
2606
|
+
const withShiftAltGr = result[3];
|
|
2607
|
+
const mask = Number(result[4]);
|
|
2608
|
+
const vkey = result.length === 6 ? result[5] : undefined;
|
|
2609
|
+
ret[key] = {
|
|
2610
|
+
'value': value,
|
|
2611
|
+
'vkey': vkey,
|
|
2612
|
+
'withShift': withShift,
|
|
2613
|
+
'withAltGr': withAltGr,
|
|
2614
|
+
'withShiftAltGr': withShiftAltGr,
|
|
2615
|
+
'valueIsDeadKey': (mask & 1) > 0,
|
|
2616
|
+
'withShiftIsDeadKey': (mask & 2) > 0,
|
|
2617
|
+
'withAltGrIsDeadKey': (mask & 4) > 0,
|
|
2618
|
+
'withShiftAltGrIsDeadKey': (mask & 8) > 0
|
|
2619
|
+
};
|
|
2620
|
+
}
|
|
2621
|
+
else {
|
|
2622
|
+
ret[key] = {
|
|
2623
|
+
'value': '',
|
|
2624
|
+
'valueIsDeadKey': false,
|
|
2625
|
+
'withShift': '',
|
|
2626
|
+
'withShiftIsDeadKey': false,
|
|
2627
|
+
'withAltGr': '',
|
|
2628
|
+
'withAltGrIsDeadKey': false,
|
|
2629
|
+
'withShiftAltGr': '',
|
|
2630
|
+
'withShiftAltGrIsDeadKey': false
|
|
2631
|
+
};
|
|
2515
2632
|
}
|
|
2516
|
-
const ariaLabel = this._mapper.getAriaLabelForKeyCode(keyCode);
|
|
2517
|
-
const userSettingsLabel = this._mapper.getUserSettingsLabelForKeyCode(keyCode);
|
|
2518
|
-
return (ariaLabel === userSettingsLabel);
|
|
2519
2633
|
}
|
|
2520
|
-
|
|
2634
|
+
return ret;
|
|
2635
|
+
}
|
|
2636
|
+
class KeymapInfo {
|
|
2637
|
+
constructor(layout, secondaryLayouts, keyboardMapping, isUserKeyboardLayout) {
|
|
2638
|
+
this.layout = layout;
|
|
2639
|
+
this.secondaryLayouts = secondaryLayouts;
|
|
2640
|
+
this.mapping = deserializeMapping(keyboardMapping);
|
|
2641
|
+
this.isUserKeyboardLayout = !!isUserKeyboardLayout;
|
|
2642
|
+
this.layout.isUserKeyboardLayout = !!isUserKeyboardLayout;
|
|
2643
|
+
}
|
|
2644
|
+
static createKeyboardLayoutFromDebugInfo(layout, value, isUserKeyboardLayout) {
|
|
2645
|
+
const keyboardLayoutInfo = ( (new KeymapInfo(layout, [], {}, true)));
|
|
2646
|
+
keyboardLayoutInfo.mapping = value;
|
|
2647
|
+
return keyboardLayoutInfo;
|
|
2648
|
+
}
|
|
2649
|
+
update(other) {
|
|
2650
|
+
this.layout = other.layout;
|
|
2651
|
+
this.secondaryLayouts = other.secondaryLayouts;
|
|
2652
|
+
this.mapping = other.mapping;
|
|
2653
|
+
this.isUserKeyboardLayout = other.isUserKeyboardLayout;
|
|
2654
|
+
this.layout.isUserKeyboardLayout = other.isUserKeyboardLayout;
|
|
2655
|
+
}
|
|
2656
|
+
getScore(other) {
|
|
2657
|
+
let score = 0;
|
|
2658
|
+
for (const key in other) {
|
|
2659
|
+
if (isWindows && (key === 'Backslash' || key === 'KeyQ')) {
|
|
2660
|
+
continue;
|
|
2661
|
+
}
|
|
2662
|
+
if (isLinux && (key === 'Backspace' || key === 'Escape')) {
|
|
2663
|
+
continue;
|
|
2664
|
+
}
|
|
2665
|
+
const currentMapping = this.mapping[key];
|
|
2666
|
+
if (currentMapping === undefined) {
|
|
2667
|
+
score -= 1;
|
|
2668
|
+
}
|
|
2669
|
+
const otherMapping = other[key];
|
|
2670
|
+
if (currentMapping && otherMapping && currentMapping.value !== otherMapping.value) {
|
|
2671
|
+
score -= 1;
|
|
2672
|
+
}
|
|
2673
|
+
}
|
|
2674
|
+
return score;
|
|
2675
|
+
}
|
|
2676
|
+
equal(other) {
|
|
2677
|
+
if (this.isUserKeyboardLayout !== other.isUserKeyboardLayout) {
|
|
2678
|
+
return false;
|
|
2679
|
+
}
|
|
2680
|
+
if (getKeyboardLayoutId(this.layout) !== getKeyboardLayoutId(other.layout)) {
|
|
2681
|
+
return false;
|
|
2682
|
+
}
|
|
2683
|
+
return this.fuzzyEqual(other.mapping);
|
|
2684
|
+
}
|
|
2685
|
+
fuzzyEqual(other) {
|
|
2686
|
+
for (const key in other) {
|
|
2687
|
+
if (isWindows && (key === 'Backslash' || key === 'KeyQ')) {
|
|
2688
|
+
continue;
|
|
2689
|
+
}
|
|
2690
|
+
if (this.mapping[key] === undefined) {
|
|
2691
|
+
return false;
|
|
2692
|
+
}
|
|
2693
|
+
const currentMapping = this.mapping[key];
|
|
2694
|
+
const otherMapping = other[key];
|
|
2695
|
+
if (currentMapping.value !== otherMapping.value) {
|
|
2696
|
+
return false;
|
|
2697
|
+
}
|
|
2698
|
+
}
|
|
2699
|
+
return true;
|
|
2700
|
+
}
|
|
2701
|
+
}
|
|
2702
|
+
function readKeyboardConfig(configurationService) {
|
|
2703
|
+
const keyboard = configurationService.getValue('keyboard');
|
|
2704
|
+
const dispatch = ((keyboard?.dispatch === 'keyCode' ? 1 : 0) );
|
|
2705
|
+
const mapAltGrToCtrlAlt = Boolean(keyboard?.mapAltGrToCtrlAlt);
|
|
2706
|
+
return { dispatch, mapAltGrToCtrlAlt };
|
|
2707
|
+
}
|
|
2708
|
+
const configurationRegistry$1 = ( (Registry.as(Extensions$1.Configuration)));
|
|
2709
|
+
const keyboardConfiguration$1 = {
|
|
2710
|
+
'id': 'keyboard',
|
|
2711
|
+
'order': 15,
|
|
2712
|
+
'type': 'object',
|
|
2713
|
+
'title': ( (localize('keyboardConfigurationTitle', "Keyboard"))),
|
|
2714
|
+
'properties': {
|
|
2715
|
+
'keyboard.dispatch': {
|
|
2716
|
+
scope: 1 ,
|
|
2717
|
+
type: 'string',
|
|
2718
|
+
enum: ['code', 'keyCode'],
|
|
2719
|
+
default: 'code',
|
|
2720
|
+
markdownDescription: ( (localize(
|
|
2721
|
+
'dispatch',
|
|
2722
|
+
"Controls the dispatching logic for key presses to use either `code` (recommended) or `keyCode`."
|
|
2723
|
+
))),
|
|
2724
|
+
included: OS === 2 || OS === 3
|
|
2725
|
+
},
|
|
2726
|
+
'keyboard.mapAltGrToCtrlAlt': {
|
|
2727
|
+
scope: 1 ,
|
|
2728
|
+
type: 'boolean',
|
|
2729
|
+
default: false,
|
|
2730
|
+
markdownDescription: ( (localize(
|
|
2731
|
+
'mapAltGrToCtrlAlt',
|
|
2732
|
+
"Controls if the AltGraph+ modifier should be treated as Ctrl+Alt+."
|
|
2733
|
+
))),
|
|
2734
|
+
included: OS === 1
|
|
2735
|
+
}
|
|
2736
|
+
}
|
|
2737
|
+
};
|
|
2738
|
+
configurationRegistry$1.registerConfiguration(keyboardConfiguration$1);
|
|
2739
|
+
class CachedKeyboardMapper {
|
|
2740
|
+
constructor(actual) {
|
|
2741
|
+
this._actual = actual;
|
|
2742
|
+
this._cache = ( (new Map()));
|
|
2743
|
+
}
|
|
2744
|
+
dumpDebugInfo() {
|
|
2745
|
+
return this._actual.dumpDebugInfo();
|
|
2746
|
+
}
|
|
2747
|
+
resolveKeyboardEvent(keyboardEvent) {
|
|
2748
|
+
return this._actual.resolveKeyboardEvent(keyboardEvent);
|
|
2749
|
+
}
|
|
2750
|
+
resolveKeybinding(keybinding) {
|
|
2751
|
+
const hashCode = keybinding.getHashCode();
|
|
2752
|
+
const resolved = this._cache.get(hashCode);
|
|
2753
|
+
if (!resolved) {
|
|
2754
|
+
const r = this._actual.resolveKeybinding(keybinding);
|
|
2755
|
+
this._cache.set(hashCode, r);
|
|
2756
|
+
return r;
|
|
2757
|
+
}
|
|
2758
|
+
return resolved;
|
|
2759
|
+
}
|
|
2760
|
+
}
|
|
2761
|
+
class WindowsNativeResolvedKeybinding extends BaseResolvedKeybinding {
|
|
2762
|
+
constructor(mapper, chords) {
|
|
2763
|
+
super(1 , chords);
|
|
2764
|
+
this._mapper = mapper;
|
|
2765
|
+
}
|
|
2766
|
+
_getLabel(chord) {
|
|
2767
|
+
if (chord.isDuplicateModifierCase()) {
|
|
2768
|
+
return '';
|
|
2769
|
+
}
|
|
2770
|
+
return this._mapper.getUILabelForKeyCode(chord.keyCode);
|
|
2771
|
+
}
|
|
2772
|
+
_getUSLabelForKeybinding(chord) {
|
|
2773
|
+
if (chord.isDuplicateModifierCase()) {
|
|
2774
|
+
return '';
|
|
2775
|
+
}
|
|
2776
|
+
return (
|
|
2777
|
+
(KeyCodeUtils.toString(chord.keyCode))
|
|
2778
|
+
);
|
|
2779
|
+
}
|
|
2780
|
+
getUSLabel() {
|
|
2781
|
+
return UILabelProvider.toLabel(this._os, this._chords, (keybinding) => this._getUSLabelForKeybinding(keybinding));
|
|
2782
|
+
}
|
|
2783
|
+
_getAriaLabel(chord) {
|
|
2784
|
+
if (chord.isDuplicateModifierCase()) {
|
|
2785
|
+
return '';
|
|
2786
|
+
}
|
|
2787
|
+
return this._mapper.getAriaLabelForKeyCode(chord.keyCode);
|
|
2788
|
+
}
|
|
2789
|
+
_getElectronAccelerator(chord) {
|
|
2790
|
+
return this._mapper.getElectronAcceleratorForKeyBinding(chord);
|
|
2791
|
+
}
|
|
2792
|
+
_getUserSettingsLabel(chord) {
|
|
2793
|
+
if (chord.isDuplicateModifierCase()) {
|
|
2794
|
+
return '';
|
|
2795
|
+
}
|
|
2796
|
+
const result = this._mapper.getUserSettingsLabelForKeyCode(chord.keyCode);
|
|
2797
|
+
return (result ? result.toLowerCase() : result);
|
|
2798
|
+
}
|
|
2799
|
+
_isWYSIWYG(chord) {
|
|
2800
|
+
return this.__isWYSIWYG(chord.keyCode);
|
|
2801
|
+
}
|
|
2802
|
+
__isWYSIWYG(keyCode) {
|
|
2803
|
+
if (keyCode === 15
|
|
2804
|
+
|| keyCode === 16
|
|
2805
|
+
|| keyCode === 17
|
|
2806
|
+
|| keyCode === 18 ) {
|
|
2807
|
+
return true;
|
|
2808
|
+
}
|
|
2809
|
+
const ariaLabel = this._mapper.getAriaLabelForKeyCode(keyCode);
|
|
2810
|
+
const userSettingsLabel = this._mapper.getUserSettingsLabelForKeyCode(keyCode);
|
|
2811
|
+
return (ariaLabel === userSettingsLabel);
|
|
2812
|
+
}
|
|
2813
|
+
_getChordDispatch(chord) {
|
|
2521
2814
|
if (chord.isModifierKey()) {
|
|
2522
2815
|
return null;
|
|
2523
2816
|
}
|
|
@@ -2649,462 +2942,170 @@ class WindowsKeyboardMapper {
|
|
|
2649
2942
|
producesLetter[charCode] = true;
|
|
2650
2943
|
producesLetters = true;
|
|
2651
2944
|
this._keyCodeToLabel[keyCode] = value;
|
|
2652
|
-
}
|
|
2653
|
-
else {
|
|
2654
|
-
this._keyCodeToLabel[keyCode] = value;
|
|
2655
|
-
}
|
|
2656
|
-
}
|
|
2657
|
-
}
|
|
2658
|
-
}
|
|
2659
|
-
const _registerLetterIfMissing = (charCode, keyCode) => {
|
|
2660
|
-
if (!producesLetter[charCode]) {
|
|
2661
|
-
this._keyCodeToLabel[keyCode] = String.fromCharCode(charCode);
|
|
2662
|
-
}
|
|
2663
|
-
};
|
|
2664
|
-
_registerLetterIfMissing(65 , 31 );
|
|
2665
|
-
_registerLetterIfMissing(66 , 32 );
|
|
2666
|
-
_registerLetterIfMissing(67 , 33 );
|
|
2667
|
-
_registerLetterIfMissing(68 , 34 );
|
|
2668
|
-
_registerLetterIfMissing(69 , 35 );
|
|
2669
|
-
_registerLetterIfMissing(70 , 36 );
|
|
2670
|
-
_registerLetterIfMissing(71 , 37 );
|
|
2671
|
-
_registerLetterIfMissing(72 , 38 );
|
|
2672
|
-
_registerLetterIfMissing(73 , 39 );
|
|
2673
|
-
_registerLetterIfMissing(74 , 40 );
|
|
2674
|
-
_registerLetterIfMissing(75 , 41 );
|
|
2675
|
-
_registerLetterIfMissing(76 , 42 );
|
|
2676
|
-
_registerLetterIfMissing(77 , 43 );
|
|
2677
|
-
_registerLetterIfMissing(78 , 44 );
|
|
2678
|
-
_registerLetterIfMissing(79 , 45 );
|
|
2679
|
-
_registerLetterIfMissing(80 , 46 );
|
|
2680
|
-
_registerLetterIfMissing(81 , 47 );
|
|
2681
|
-
_registerLetterIfMissing(82 , 48 );
|
|
2682
|
-
_registerLetterIfMissing(83 , 49 );
|
|
2683
|
-
_registerLetterIfMissing(84 , 50 );
|
|
2684
|
-
_registerLetterIfMissing(85 , 51 );
|
|
2685
|
-
_registerLetterIfMissing(86 , 52 );
|
|
2686
|
-
_registerLetterIfMissing(87 , 53 );
|
|
2687
|
-
_registerLetterIfMissing(88 , 54 );
|
|
2688
|
-
_registerLetterIfMissing(89 , 55 );
|
|
2689
|
-
_registerLetterIfMissing(90 , 56 );
|
|
2690
|
-
if (!producesLetters) {
|
|
2691
|
-
const _registerLabel = (keyCode, charCode) => {
|
|
2692
|
-
this._keyCodeToLabel[keyCode] = String.fromCharCode(charCode);
|
|
2693
|
-
};
|
|
2694
|
-
_registerLabel(80 , 59 );
|
|
2695
|
-
_registerLabel(81 , 61 );
|
|
2696
|
-
_registerLabel(82 , 44 );
|
|
2697
|
-
_registerLabel(83 , 45 );
|
|
2698
|
-
_registerLabel(84 , 46 );
|
|
2699
|
-
_registerLabel(85 , 47 );
|
|
2700
|
-
_registerLabel(86 , 96 );
|
|
2701
|
-
_registerLabel(87 , 91 );
|
|
2702
|
-
_registerLabel(88 , 92 );
|
|
2703
|
-
_registerLabel(89 , 93 );
|
|
2704
|
-
_registerLabel(90 , 39 );
|
|
2705
|
-
}
|
|
2706
|
-
}
|
|
2707
|
-
dumpDebugInfo() {
|
|
2708
|
-
const result = [];
|
|
2709
|
-
const immutableSamples = [
|
|
2710
|
-
88 ,
|
|
2711
|
-
104
|
|
2712
|
-
];
|
|
2713
|
-
let cnt = 0;
|
|
2714
|
-
result.push(`-----------------------------------------------------------------------------------------------------------------------------------------`);
|
|
2715
|
-
for (let scanCode = 0 ; scanCode < 193 ; scanCode++) {
|
|
2716
|
-
if (IMMUTABLE_CODE_TO_KEY_CODE[scanCode] !== -1 ) {
|
|
2717
|
-
if (immutableSamples.indexOf(scanCode) === -1) {
|
|
2718
|
-
continue;
|
|
2719
|
-
}
|
|
2720
|
-
}
|
|
2721
|
-
if (cnt % 6 === 0) {
|
|
2722
|
-
result.push(`| HW Code combination | Key | KeyCode combination | UI label | User settings | WYSIWYG |`);
|
|
2723
|
-
result.push(`-----------------------------------------------------------------------------------------------------------------------------------------`);
|
|
2724
|
-
}
|
|
2725
|
-
cnt++;
|
|
2726
|
-
const mapping = this._codeInfo[scanCode];
|
|
2727
|
-
const strCode = ( (ScanCodeUtils.toString(scanCode)));
|
|
2728
|
-
const mods = [0b000, 0b010, 0b101, 0b111];
|
|
2729
|
-
for (const mod of mods) {
|
|
2730
|
-
const ctrlKey = (mod & 0b001) ? true : false;
|
|
2731
|
-
const shiftKey = (mod & 0b010) ? true : false;
|
|
2732
|
-
const altKey = (mod & 0b100) ? true : false;
|
|
2733
|
-
const scanCodeChord = ( (new ScanCodeChord(ctrlKey, shiftKey, altKey, false, scanCode)));
|
|
2734
|
-
const keyCodeChord = this._resolveChord(scanCodeChord);
|
|
2735
|
-
const strKeyCode = (keyCodeChord ? ( (KeyCodeUtils.toString(keyCodeChord.keyCode))) : null);
|
|
2736
|
-
const resolvedKb = (keyCodeChord ? ( (new WindowsNativeResolvedKeybinding(this, [keyCodeChord]))) : null);
|
|
2737
|
-
const outScanCode = `${ctrlKey ? 'Ctrl+' : ''}${shiftKey ? 'Shift+' : ''}${altKey ? 'Alt+' : ''}${strCode}`;
|
|
2738
|
-
const ariaLabel = (resolvedKb ? resolvedKb.getAriaLabel() : null);
|
|
2739
|
-
const outUILabel = (ariaLabel ? ariaLabel.replace(/Control\+/, 'Ctrl+') : null);
|
|
2740
|
-
const outUserSettings = (resolvedKb ? resolvedKb.getUserSettingsLabel() : null);
|
|
2741
|
-
const outKey = WindowsNativeResolvedKeybinding.getProducedChar(scanCodeChord, mapping);
|
|
2742
|
-
const outKb = (strKeyCode ? `${ctrlKey ? 'Ctrl+' : ''}${shiftKey ? 'Shift+' : ''}${altKey ? 'Alt+' : ''}${strKeyCode}` : null);
|
|
2743
|
-
const isWYSIWYG = (resolvedKb ? resolvedKb.isWYSIWYG() : false);
|
|
2744
|
-
const outWYSIWYG = (isWYSIWYG ? ' ' : ' NO ');
|
|
2745
|
-
result.push(`| ${this._leftPad(outScanCode, 30)} | ${outKey} | ${this._leftPad(outKb, 25)} | ${this._leftPad(outUILabel, 25)} | ${this._leftPad(outUserSettings, 25)} | ${outWYSIWYG} |`);
|
|
2746
|
-
}
|
|
2747
|
-
result.push(`-----------------------------------------------------------------------------------------------------------------------------------------`);
|
|
2748
|
-
}
|
|
2749
|
-
return result.join('\n');
|
|
2750
|
-
}
|
|
2751
|
-
_leftPad(str, cnt) {
|
|
2752
|
-
if (str === null) {
|
|
2753
|
-
str = 'null';
|
|
2754
|
-
}
|
|
2755
|
-
while (str.length < cnt) {
|
|
2756
|
-
str = ' ' + str;
|
|
2757
|
-
}
|
|
2758
|
-
return str;
|
|
2759
|
-
}
|
|
2760
|
-
getUILabelForKeyCode(keyCode) {
|
|
2761
|
-
return this._getLabelForKeyCode(keyCode);
|
|
2762
|
-
}
|
|
2763
|
-
getAriaLabelForKeyCode(keyCode) {
|
|
2764
|
-
return this._getLabelForKeyCode(keyCode);
|
|
2765
|
-
}
|
|
2766
|
-
getUserSettingsLabelForKeyCode(keyCode) {
|
|
2767
|
-
if (this._isUSStandard) {
|
|
2768
|
-
return KeyCodeUtils.toUserSettingsUS(keyCode);
|
|
2769
|
-
}
|
|
2770
|
-
return KeyCodeUtils.toUserSettingsGeneral(keyCode);
|
|
2771
|
-
}
|
|
2772
|
-
getElectronAcceleratorForKeyBinding(chord) {
|
|
2773
|
-
return KeyCodeUtils.toElectronAccelerator(chord.keyCode);
|
|
2774
|
-
}
|
|
2775
|
-
_getLabelForKeyCode(keyCode) {
|
|
2776
|
-
return this._keyCodeToLabel[keyCode] || ( (KeyCodeUtils.toString(0 )));
|
|
2777
|
-
}
|
|
2778
|
-
resolveKeyboardEvent(keyboardEvent) {
|
|
2779
|
-
const ctrlKey = keyboardEvent.ctrlKey || (this._mapAltGrToCtrlAlt && keyboardEvent.altGraphKey);
|
|
2780
|
-
const altKey = keyboardEvent.altKey || (this._mapAltGrToCtrlAlt && keyboardEvent.altGraphKey);
|
|
2781
|
-
const chord = ( (new KeyCodeChord(
|
|
2782
|
-
ctrlKey,
|
|
2783
|
-
keyboardEvent.shiftKey,
|
|
2784
|
-
altKey,
|
|
2785
|
-
keyboardEvent.metaKey,
|
|
2786
|
-
keyboardEvent.keyCode
|
|
2787
|
-
)));
|
|
2788
|
-
return (
|
|
2789
|
-
(new WindowsNativeResolvedKeybinding(this, [chord]))
|
|
2790
|
-
);
|
|
2791
|
-
}
|
|
2792
|
-
_resolveChord(chord) {
|
|
2793
|
-
if (!chord) {
|
|
2794
|
-
return null;
|
|
2795
|
-
}
|
|
2796
|
-
if (chord instanceof KeyCodeChord) {
|
|
2797
|
-
if (!this._keyCodeExists[chord.keyCode]) {
|
|
2798
|
-
return null;
|
|
2799
|
-
}
|
|
2800
|
-
return chord;
|
|
2801
|
-
}
|
|
2802
|
-
const keyCode = this._scanCodeToKeyCode[chord.scanCode] || 0 ;
|
|
2803
|
-
if (keyCode === 0 || !this._keyCodeExists[keyCode]) {
|
|
2804
|
-
return null;
|
|
2805
|
-
}
|
|
2806
|
-
return (
|
|
2807
|
-
(new KeyCodeChord(chord.ctrlKey, chord.shiftKey, chord.altKey, chord.metaKey, keyCode))
|
|
2808
|
-
);
|
|
2809
|
-
}
|
|
2810
|
-
resolveKeybinding(keybinding) {
|
|
2811
|
-
const chords = toEmptyArrayIfContainsNull(keybinding.chords.map(chord => this._resolveChord(chord)));
|
|
2812
|
-
if (chords.length > 0) {
|
|
2813
|
-
return [( (new WindowsNativeResolvedKeybinding(this, chords)))];
|
|
2814
|
-
}
|
|
2815
|
-
return [];
|
|
2816
|
-
}
|
|
2817
|
-
}
|
|
2818
|
-
let CommandsQuickAccessProvider = class CommandsQuickAccessProvider extends AbstractEditorCommandsQuickAccessProvider {
|
|
2819
|
-
get activeTextEditorControl() { return this.editorService.activeTextEditorControl; }
|
|
2820
|
-
get defaultFilterValue() {
|
|
2821
|
-
if (this.configuration.preserveInput) {
|
|
2822
|
-
return DefaultQuickAccessFilterValue.LAST;
|
|
2823
|
-
}
|
|
2824
|
-
return undefined;
|
|
2825
|
-
}
|
|
2826
|
-
constructor(editorService, menuService, extensionService, instantiationService, keybindingService, commandService, telemetryService, dialogService, configurationService, editorGroupService, preferencesService, productService) {
|
|
2827
|
-
super({
|
|
2828
|
-
showAlias: !Language.isDefaultVariant(),
|
|
2829
|
-
noResultsPick: {
|
|
2830
|
-
label: ( (localize('noCommandResults', "No matching commands"))),
|
|
2831
|
-
commandId: ''
|
|
2832
|
-
}
|
|
2833
|
-
}, instantiationService, keybindingService, commandService, telemetryService, dialogService);
|
|
2834
|
-
this.editorService = editorService;
|
|
2835
|
-
this.menuService = menuService;
|
|
2836
|
-
this.extensionService = extensionService;
|
|
2837
|
-
this.configurationService = configurationService;
|
|
2838
|
-
this.editorGroupService = editorGroupService;
|
|
2839
|
-
this.preferencesService = preferencesService;
|
|
2840
|
-
this.productService = productService;
|
|
2841
|
-
this.extensionRegistrationRace = Promise.race([
|
|
2842
|
-
timeout(800),
|
|
2843
|
-
this.extensionService.whenInstalledExtensionsRegistered()
|
|
2844
|
-
]);
|
|
2845
|
-
this._register(configurationService.onDidChangeConfiguration((e) => this.updateSuggestedCommandIds(e)));
|
|
2846
|
-
this.updateSuggestedCommandIds();
|
|
2847
|
-
}
|
|
2848
|
-
get configuration() {
|
|
2849
|
-
const commandPaletteConfig = this.configurationService.getValue().workbench.commandPalette;
|
|
2850
|
-
return {
|
|
2851
|
-
preserveInput: commandPaletteConfig.preserveInput,
|
|
2852
|
-
experimental: commandPaletteConfig.experimental
|
|
2853
|
-
};
|
|
2854
|
-
}
|
|
2855
|
-
updateSuggestedCommandIds(e) {
|
|
2856
|
-
if (e && !e.affectsConfiguration('workbench.commandPalette.experimental.suggestCommands')) {
|
|
2857
|
-
return;
|
|
2858
|
-
}
|
|
2859
|
-
const config = this.configuration;
|
|
2860
|
-
const suggestedCommandIds = config.experimental.suggestCommands && this.productService.commandPaletteSuggestedCommandIds?.length
|
|
2861
|
-
? ( (new Set(this.productService.commandPaletteSuggestedCommandIds)))
|
|
2862
|
-
: undefined;
|
|
2863
|
-
this.options.suggestedCommandIds = suggestedCommandIds;
|
|
2864
|
-
}
|
|
2865
|
-
async getCommandPicks(token) {
|
|
2866
|
-
await this.extensionRegistrationRace;
|
|
2867
|
-
if (token.isCancellationRequested) {
|
|
2868
|
-
return [];
|
|
2869
|
-
}
|
|
2870
|
-
return [
|
|
2871
|
-
...this.getCodeEditorCommandPicks(),
|
|
2872
|
-
...this.getGlobalCommandPicks()
|
|
2873
|
-
].map(c => ({
|
|
2874
|
-
...c,
|
|
2875
|
-
buttons: [{
|
|
2876
|
-
iconClass: ThemeIcon.asClassName(Codicon.gear),
|
|
2877
|
-
tooltip: ( (localize('configure keybinding', "Configure Keybinding"))),
|
|
2878
|
-
}],
|
|
2879
|
-
trigger: () => {
|
|
2880
|
-
this.preferencesService.openGlobalKeybindingSettings(false, { query: `@command:${c.commandId}` });
|
|
2881
|
-
return TriggerAction.CLOSE_PICKER;
|
|
2882
|
-
},
|
|
2883
|
-
}));
|
|
2884
|
-
}
|
|
2885
|
-
getGlobalCommandPicks() {
|
|
2886
|
-
const globalCommandPicks = [];
|
|
2887
|
-
const scopedContextKeyService = this.editorService.activeEditorPane?.scopedContextKeyService || this.editorGroupService.activeGroup.scopedContextKeyService;
|
|
2888
|
-
const globalCommandsMenu = this.menuService.createMenu(MenuId.CommandPalette, scopedContextKeyService);
|
|
2889
|
-
const globalCommandsMenuActions = globalCommandsMenu.getActions()
|
|
2890
|
-
.reduce((r, [, actions]) => [...r, ...actions], [])
|
|
2891
|
-
.filter(action => action instanceof MenuItemAction && action.enabled);
|
|
2892
|
-
for (const action of globalCommandsMenuActions) {
|
|
2893
|
-
let label = (typeof action.item.title === 'string' ? action.item.title : action.item.title.value) || action.item.id;
|
|
2894
|
-
const category = typeof action.item.category === 'string' ? action.item.category : action.item.category?.value;
|
|
2895
|
-
if (category) {
|
|
2896
|
-
label = ( (localize('commandWithCategory', "{0}: {1}", category, label)));
|
|
2897
|
-
}
|
|
2898
|
-
const aliasLabel = typeof action.item.title !== 'string' ? action.item.title.original : undefined;
|
|
2899
|
-
const aliasCategory = (category && action.item.category && typeof action.item.category !== 'string') ? action.item.category.original : undefined;
|
|
2900
|
-
const commandAlias = (aliasLabel && category) ?
|
|
2901
|
-
aliasCategory ? `${aliasCategory}: ${aliasLabel}` : `${category}: ${aliasLabel}` :
|
|
2902
|
-
aliasLabel;
|
|
2903
|
-
globalCommandPicks.push({
|
|
2904
|
-
commandId: action.item.id,
|
|
2905
|
-
commandAlias,
|
|
2906
|
-
label: stripIcons(label)
|
|
2907
|
-
});
|
|
2908
|
-
}
|
|
2909
|
-
globalCommandsMenu.dispose();
|
|
2910
|
-
return globalCommandPicks;
|
|
2911
|
-
}
|
|
2912
|
-
};
|
|
2913
|
-
CommandsQuickAccessProvider = ( (__decorate([
|
|
2914
|
-
( (__param(0, IEditorService))),
|
|
2915
|
-
( (__param(1, IMenuService))),
|
|
2916
|
-
( (__param(2, IExtensionService))),
|
|
2917
|
-
( (__param(3, IInstantiationService))),
|
|
2918
|
-
( (__param(4, IKeybindingService))),
|
|
2919
|
-
( (__param(5, ICommandService))),
|
|
2920
|
-
( (__param(6, ITelemetryService))),
|
|
2921
|
-
( (__param(7, IDialogService))),
|
|
2922
|
-
( (__param(8, IConfigurationService))),
|
|
2923
|
-
( (__param(9, IEditorGroupsService))),
|
|
2924
|
-
( (__param(10, IPreferencesService))),
|
|
2925
|
-
( (__param(11, IProductService)))
|
|
2926
|
-
], CommandsQuickAccessProvider)));
|
|
2927
|
-
class ShowAllCommandsAction extends Action2 {
|
|
2928
|
-
constructor() {
|
|
2929
|
-
super({
|
|
2930
|
-
id: ShowAllCommandsAction.ID,
|
|
2931
|
-
title: { value: ( (localize('showTriggerActions', "Show All Commands"))), original: 'Show All Commands' },
|
|
2932
|
-
keybinding: {
|
|
2933
|
-
weight: 200 ,
|
|
2934
|
-
when: undefined,
|
|
2935
|
-
primary: !isFirefox ? ((2048 | 1024 | 46) ) : undefined,
|
|
2936
|
-
secondary: [59 ]
|
|
2937
|
-
},
|
|
2938
|
-
f1: true
|
|
2939
|
-
});
|
|
2940
|
-
}
|
|
2941
|
-
async run(accessor) {
|
|
2942
|
-
accessor.get(IQuickInputService).quickAccess.show(CommandsQuickAccessProvider.PREFIX);
|
|
2943
|
-
}
|
|
2944
|
-
}
|
|
2945
|
-
ShowAllCommandsAction.ID = 'workbench.action.showCommands';
|
|
2946
|
-
function deserializeMapping(serializedMapping) {
|
|
2947
|
-
const mapping = serializedMapping;
|
|
2948
|
-
const ret = {};
|
|
2949
|
-
for (const key in mapping) {
|
|
2950
|
-
const result = mapping[key];
|
|
2951
|
-
if (result.length) {
|
|
2952
|
-
const value = result[0];
|
|
2953
|
-
const withShift = result[1];
|
|
2954
|
-
const withAltGr = result[2];
|
|
2955
|
-
const withShiftAltGr = result[3];
|
|
2956
|
-
const mask = Number(result[4]);
|
|
2957
|
-
const vkey = result.length === 6 ? result[5] : undefined;
|
|
2958
|
-
ret[key] = {
|
|
2959
|
-
'value': value,
|
|
2960
|
-
'vkey': vkey,
|
|
2961
|
-
'withShift': withShift,
|
|
2962
|
-
'withAltGr': withAltGr,
|
|
2963
|
-
'withShiftAltGr': withShiftAltGr,
|
|
2964
|
-
'valueIsDeadKey': (mask & 1) > 0,
|
|
2965
|
-
'withShiftIsDeadKey': (mask & 2) > 0,
|
|
2966
|
-
'withAltGrIsDeadKey': (mask & 4) > 0,
|
|
2967
|
-
'withShiftAltGrIsDeadKey': (mask & 8) > 0
|
|
2968
|
-
};
|
|
2969
|
-
}
|
|
2970
|
-
else {
|
|
2971
|
-
ret[key] = {
|
|
2972
|
-
'value': '',
|
|
2973
|
-
'valueIsDeadKey': false,
|
|
2974
|
-
'withShift': '',
|
|
2975
|
-
'withShiftIsDeadKey': false,
|
|
2976
|
-
'withAltGr': '',
|
|
2977
|
-
'withAltGrIsDeadKey': false,
|
|
2978
|
-
'withShiftAltGr': '',
|
|
2979
|
-
'withShiftAltGrIsDeadKey': false
|
|
2945
|
+
}
|
|
2946
|
+
else {
|
|
2947
|
+
this._keyCodeToLabel[keyCode] = value;
|
|
2948
|
+
}
|
|
2949
|
+
}
|
|
2950
|
+
}
|
|
2951
|
+
}
|
|
2952
|
+
const _registerLetterIfMissing = (charCode, keyCode) => {
|
|
2953
|
+
if (!producesLetter[charCode]) {
|
|
2954
|
+
this._keyCodeToLabel[keyCode] = String.fromCharCode(charCode);
|
|
2955
|
+
}
|
|
2956
|
+
};
|
|
2957
|
+
_registerLetterIfMissing(65 , 31 );
|
|
2958
|
+
_registerLetterIfMissing(66 , 32 );
|
|
2959
|
+
_registerLetterIfMissing(67 , 33 );
|
|
2960
|
+
_registerLetterIfMissing(68 , 34 );
|
|
2961
|
+
_registerLetterIfMissing(69 , 35 );
|
|
2962
|
+
_registerLetterIfMissing(70 , 36 );
|
|
2963
|
+
_registerLetterIfMissing(71 , 37 );
|
|
2964
|
+
_registerLetterIfMissing(72 , 38 );
|
|
2965
|
+
_registerLetterIfMissing(73 , 39 );
|
|
2966
|
+
_registerLetterIfMissing(74 , 40 );
|
|
2967
|
+
_registerLetterIfMissing(75 , 41 );
|
|
2968
|
+
_registerLetterIfMissing(76 , 42 );
|
|
2969
|
+
_registerLetterIfMissing(77 , 43 );
|
|
2970
|
+
_registerLetterIfMissing(78 , 44 );
|
|
2971
|
+
_registerLetterIfMissing(79 , 45 );
|
|
2972
|
+
_registerLetterIfMissing(80 , 46 );
|
|
2973
|
+
_registerLetterIfMissing(81 , 47 );
|
|
2974
|
+
_registerLetterIfMissing(82 , 48 );
|
|
2975
|
+
_registerLetterIfMissing(83 , 49 );
|
|
2976
|
+
_registerLetterIfMissing(84 , 50 );
|
|
2977
|
+
_registerLetterIfMissing(85 , 51 );
|
|
2978
|
+
_registerLetterIfMissing(86 , 52 );
|
|
2979
|
+
_registerLetterIfMissing(87 , 53 );
|
|
2980
|
+
_registerLetterIfMissing(88 , 54 );
|
|
2981
|
+
_registerLetterIfMissing(89 , 55 );
|
|
2982
|
+
_registerLetterIfMissing(90 , 56 );
|
|
2983
|
+
if (!producesLetters) {
|
|
2984
|
+
const _registerLabel = (keyCode, charCode) => {
|
|
2985
|
+
this._keyCodeToLabel[keyCode] = String.fromCharCode(charCode);
|
|
2980
2986
|
};
|
|
2987
|
+
_registerLabel(80 , 59 );
|
|
2988
|
+
_registerLabel(81 , 61 );
|
|
2989
|
+
_registerLabel(82 , 44 );
|
|
2990
|
+
_registerLabel(83 , 45 );
|
|
2991
|
+
_registerLabel(84 , 46 );
|
|
2992
|
+
_registerLabel(85 , 47 );
|
|
2993
|
+
_registerLabel(86 , 96 );
|
|
2994
|
+
_registerLabel(87 , 91 );
|
|
2995
|
+
_registerLabel(88 , 92 );
|
|
2996
|
+
_registerLabel(89 , 93 );
|
|
2997
|
+
_registerLabel(90 , 39 );
|
|
2981
2998
|
}
|
|
2982
2999
|
}
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
return keyboardLayoutInfo;
|
|
2997
|
-
}
|
|
2998
|
-
update(other) {
|
|
2999
|
-
this.layout = other.layout;
|
|
3000
|
-
this.secondaryLayouts = other.secondaryLayouts;
|
|
3001
|
-
this.mapping = other.mapping;
|
|
3002
|
-
this.isUserKeyboardLayout = other.isUserKeyboardLayout;
|
|
3003
|
-
this.layout.isUserKeyboardLayout = other.isUserKeyboardLayout;
|
|
3004
|
-
}
|
|
3005
|
-
getScore(other) {
|
|
3006
|
-
let score = 0;
|
|
3007
|
-
for (const key in other) {
|
|
3008
|
-
if (isWindows && (key === 'Backslash' || key === 'KeyQ')) {
|
|
3009
|
-
continue;
|
|
3010
|
-
}
|
|
3011
|
-
if (isLinux && (key === 'Backspace' || key === 'Escape')) {
|
|
3012
|
-
continue;
|
|
3000
|
+
dumpDebugInfo() {
|
|
3001
|
+
const result = [];
|
|
3002
|
+
const immutableSamples = [
|
|
3003
|
+
88 ,
|
|
3004
|
+
104
|
|
3005
|
+
];
|
|
3006
|
+
let cnt = 0;
|
|
3007
|
+
result.push(`-----------------------------------------------------------------------------------------------------------------------------------------`);
|
|
3008
|
+
for (let scanCode = 0 ; scanCode < 193 ; scanCode++) {
|
|
3009
|
+
if (IMMUTABLE_CODE_TO_KEY_CODE[scanCode] !== -1 ) {
|
|
3010
|
+
if (immutableSamples.indexOf(scanCode) === -1) {
|
|
3011
|
+
continue;
|
|
3012
|
+
}
|
|
3013
3013
|
}
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
-
|
|
3014
|
+
if (cnt % 6 === 0) {
|
|
3015
|
+
result.push(`| HW Code combination | Key | KeyCode combination | UI label | User settings | WYSIWYG |`);
|
|
3016
|
+
result.push(`-----------------------------------------------------------------------------------------------------------------------------------------`);
|
|
3017
3017
|
}
|
|
3018
|
-
|
|
3019
|
-
|
|
3020
|
-
|
|
3018
|
+
cnt++;
|
|
3019
|
+
const mapping = this._codeInfo[scanCode];
|
|
3020
|
+
const strCode = ( (ScanCodeUtils.toString(scanCode)));
|
|
3021
|
+
const mods = [0b000, 0b010, 0b101, 0b111];
|
|
3022
|
+
for (const mod of mods) {
|
|
3023
|
+
const ctrlKey = (mod & 0b001) ? true : false;
|
|
3024
|
+
const shiftKey = (mod & 0b010) ? true : false;
|
|
3025
|
+
const altKey = (mod & 0b100) ? true : false;
|
|
3026
|
+
const scanCodeChord = ( (new ScanCodeChord(ctrlKey, shiftKey, altKey, false, scanCode)));
|
|
3027
|
+
const keyCodeChord = this._resolveChord(scanCodeChord);
|
|
3028
|
+
const strKeyCode = (keyCodeChord ? ( (KeyCodeUtils.toString(keyCodeChord.keyCode))) : null);
|
|
3029
|
+
const resolvedKb = (keyCodeChord ? ( (new WindowsNativeResolvedKeybinding(this, [keyCodeChord]))) : null);
|
|
3030
|
+
const outScanCode = `${ctrlKey ? 'Ctrl+' : ''}${shiftKey ? 'Shift+' : ''}${altKey ? 'Alt+' : ''}${strCode}`;
|
|
3031
|
+
const ariaLabel = (resolvedKb ? resolvedKb.getAriaLabel() : null);
|
|
3032
|
+
const outUILabel = (ariaLabel ? ariaLabel.replace(/Control\+/, 'Ctrl+') : null);
|
|
3033
|
+
const outUserSettings = (resolvedKb ? resolvedKb.getUserSettingsLabel() : null);
|
|
3034
|
+
const outKey = WindowsNativeResolvedKeybinding.getProducedChar(scanCodeChord, mapping);
|
|
3035
|
+
const outKb = (strKeyCode ? `${ctrlKey ? 'Ctrl+' : ''}${shiftKey ? 'Shift+' : ''}${altKey ? 'Alt+' : ''}${strKeyCode}` : null);
|
|
3036
|
+
const isWYSIWYG = (resolvedKb ? resolvedKb.isWYSIWYG() : false);
|
|
3037
|
+
const outWYSIWYG = (isWYSIWYG ? ' ' : ' NO ');
|
|
3038
|
+
result.push(`| ${this._leftPad(outScanCode, 30)} | ${outKey} | ${this._leftPad(outKb, 25)} | ${this._leftPad(outUILabel, 25)} | ${this._leftPad(outUserSettings, 25)} | ${outWYSIWYG} |`);
|
|
3021
3039
|
}
|
|
3040
|
+
result.push(`-----------------------------------------------------------------------------------------------------------------------------------------`);
|
|
3022
3041
|
}
|
|
3023
|
-
return
|
|
3042
|
+
return result.join('\n');
|
|
3024
3043
|
}
|
|
3025
|
-
|
|
3026
|
-
if (
|
|
3027
|
-
|
|
3044
|
+
_leftPad(str, cnt) {
|
|
3045
|
+
if (str === null) {
|
|
3046
|
+
str = 'null';
|
|
3028
3047
|
}
|
|
3029
|
-
|
|
3030
|
-
|
|
3048
|
+
while (str.length < cnt) {
|
|
3049
|
+
str = ' ' + str;
|
|
3031
3050
|
}
|
|
3032
|
-
return
|
|
3051
|
+
return str;
|
|
3033
3052
|
}
|
|
3034
|
-
|
|
3035
|
-
|
|
3036
|
-
if (isWindows && (key === 'Backslash' || key === 'KeyQ')) {
|
|
3037
|
-
continue;
|
|
3038
|
-
}
|
|
3039
|
-
if (this.mapping[key] === undefined) {
|
|
3040
|
-
return false;
|
|
3041
|
-
}
|
|
3042
|
-
const currentMapping = this.mapping[key];
|
|
3043
|
-
const otherMapping = other[key];
|
|
3044
|
-
if (currentMapping.value !== otherMapping.value) {
|
|
3045
|
-
return false;
|
|
3046
|
-
}
|
|
3047
|
-
}
|
|
3048
|
-
return true;
|
|
3053
|
+
getUILabelForKeyCode(keyCode) {
|
|
3054
|
+
return this._getLabelForKeyCode(keyCode);
|
|
3049
3055
|
}
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
}
|
|
3057
|
-
const configurationRegistry$1 = ( (Registry.as(Extensions$1.Configuration)));
|
|
3058
|
-
const keyboardConfiguration$1 = {
|
|
3059
|
-
'id': 'keyboard',
|
|
3060
|
-
'order': 15,
|
|
3061
|
-
'type': 'object',
|
|
3062
|
-
'title': ( (localize('keyboardConfigurationTitle', "Keyboard"))),
|
|
3063
|
-
'properties': {
|
|
3064
|
-
'keyboard.dispatch': {
|
|
3065
|
-
scope: 1 ,
|
|
3066
|
-
type: 'string',
|
|
3067
|
-
enum: ['code', 'keyCode'],
|
|
3068
|
-
default: 'code',
|
|
3069
|
-
markdownDescription: ( (localize(
|
|
3070
|
-
'dispatch',
|
|
3071
|
-
"Controls the dispatching logic for key presses to use either `code` (recommended) or `keyCode`."
|
|
3072
|
-
))),
|
|
3073
|
-
included: OS === 2 || OS === 3
|
|
3074
|
-
},
|
|
3075
|
-
'keyboard.mapAltGrToCtrlAlt': {
|
|
3076
|
-
scope: 1 ,
|
|
3077
|
-
type: 'boolean',
|
|
3078
|
-
default: false,
|
|
3079
|
-
markdownDescription: ( (localize(
|
|
3080
|
-
'mapAltGrToCtrlAlt',
|
|
3081
|
-
"Controls if the AltGraph+ modifier should be treated as Ctrl+Alt+."
|
|
3082
|
-
))),
|
|
3083
|
-
included: OS === 1
|
|
3056
|
+
getAriaLabelForKeyCode(keyCode) {
|
|
3057
|
+
return this._getLabelForKeyCode(keyCode);
|
|
3058
|
+
}
|
|
3059
|
+
getUserSettingsLabelForKeyCode(keyCode) {
|
|
3060
|
+
if (this._isUSStandard) {
|
|
3061
|
+
return KeyCodeUtils.toUserSettingsUS(keyCode);
|
|
3084
3062
|
}
|
|
3063
|
+
return KeyCodeUtils.toUserSettingsGeneral(keyCode);
|
|
3085
3064
|
}
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
class CachedKeyboardMapper {
|
|
3089
|
-
constructor(actual) {
|
|
3090
|
-
this._actual = actual;
|
|
3091
|
-
this._cache = ( (new Map()));
|
|
3065
|
+
getElectronAcceleratorForKeyBinding(chord) {
|
|
3066
|
+
return KeyCodeUtils.toElectronAccelerator(chord.keyCode);
|
|
3092
3067
|
}
|
|
3093
|
-
|
|
3094
|
-
return this.
|
|
3068
|
+
_getLabelForKeyCode(keyCode) {
|
|
3069
|
+
return this._keyCodeToLabel[keyCode] || ( (KeyCodeUtils.toString(0 )));
|
|
3095
3070
|
}
|
|
3096
3071
|
resolveKeyboardEvent(keyboardEvent) {
|
|
3097
|
-
|
|
3072
|
+
const ctrlKey = keyboardEvent.ctrlKey || (this._mapAltGrToCtrlAlt && keyboardEvent.altGraphKey);
|
|
3073
|
+
const altKey = keyboardEvent.altKey || (this._mapAltGrToCtrlAlt && keyboardEvent.altGraphKey);
|
|
3074
|
+
const chord = ( (new KeyCodeChord(
|
|
3075
|
+
ctrlKey,
|
|
3076
|
+
keyboardEvent.shiftKey,
|
|
3077
|
+
altKey,
|
|
3078
|
+
keyboardEvent.metaKey,
|
|
3079
|
+
keyboardEvent.keyCode
|
|
3080
|
+
)));
|
|
3081
|
+
return (
|
|
3082
|
+
(new WindowsNativeResolvedKeybinding(this, [chord]))
|
|
3083
|
+
);
|
|
3084
|
+
}
|
|
3085
|
+
_resolveChord(chord) {
|
|
3086
|
+
if (!chord) {
|
|
3087
|
+
return null;
|
|
3088
|
+
}
|
|
3089
|
+
if (chord instanceof KeyCodeChord) {
|
|
3090
|
+
if (!this._keyCodeExists[chord.keyCode]) {
|
|
3091
|
+
return null;
|
|
3092
|
+
}
|
|
3093
|
+
return chord;
|
|
3094
|
+
}
|
|
3095
|
+
const keyCode = this._scanCodeToKeyCode[chord.scanCode] || 0 ;
|
|
3096
|
+
if (keyCode === 0 || !this._keyCodeExists[keyCode]) {
|
|
3097
|
+
return null;
|
|
3098
|
+
}
|
|
3099
|
+
return (
|
|
3100
|
+
(new KeyCodeChord(chord.ctrlKey, chord.shiftKey, chord.altKey, chord.metaKey, keyCode))
|
|
3101
|
+
);
|
|
3098
3102
|
}
|
|
3099
3103
|
resolveKeybinding(keybinding) {
|
|
3100
|
-
const
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
const r = this._actual.resolveKeybinding(keybinding);
|
|
3104
|
-
this._cache.set(hashCode, r);
|
|
3105
|
-
return r;
|
|
3104
|
+
const chords = toEmptyArrayIfContainsNull(( (keybinding.chords.map(chord => this._resolveChord(chord)))));
|
|
3105
|
+
if (chords.length > 0) {
|
|
3106
|
+
return [( (new WindowsNativeResolvedKeybinding(this, chords)))];
|
|
3106
3107
|
}
|
|
3107
|
-
return
|
|
3108
|
+
return [];
|
|
3108
3109
|
}
|
|
3109
3110
|
}
|
|
3110
3111
|
const CHAR_CODE_TO_KEY_CODE = [];
|
|
@@ -3912,7 +3913,7 @@ class MacLinuxKeyboardMapper {
|
|
|
3912
3913
|
return this.keyCodeChordToScanCodeChord(chord);
|
|
3913
3914
|
}
|
|
3914
3915
|
resolveKeybinding(keybinding) {
|
|
3915
|
-
const chords = keybinding.chords.map(chord => this._resolveChord(chord));
|
|
3916
|
+
const chords = ( (keybinding.chords.map(chord => this._resolveChord(chord))));
|
|
3916
3917
|
return this._toResolvedKeybinding(chords);
|
|
3917
3918
|
}
|
|
3918
3919
|
static _redirectCharCode(charCode) {
|
|
@@ -4023,7 +4024,9 @@ class BrowserKeyboardMapperFactoryBase extends Disposable {
|
|
|
4023
4024
|
return this._activeKeymapInfo?.mapping ?? null;
|
|
4024
4025
|
}
|
|
4025
4026
|
get keyboardLayouts() {
|
|
4026
|
-
return
|
|
4027
|
+
return (
|
|
4028
|
+
(this._keymapInfos.map(keymapInfo => keymapInfo.layout))
|
|
4029
|
+
);
|
|
4027
4030
|
}
|
|
4028
4031
|
constructor(_configurationService) {
|
|
4029
4032
|
super();
|
|
@@ -4307,12 +4310,12 @@ class BrowserKeyboardMapperFactory extends BrowserKeyboardMapperFactoryBase {
|
|
|
4307
4310
|
const platform = isWindows ? 'win' : isMacintosh ? 'darwin' : 'linux';
|
|
4308
4311
|
__variableDynamicImportRuntime0__('./keyboardLayouts/layout.contribution.' + platform + '.js').then((m) => {
|
|
4309
4312
|
const keymapInfos = m.KeyboardLayoutContribution.INSTANCE.layoutInfos;
|
|
4310
|
-
this._keymapInfos.push(...keymapInfos.map(info => (( (new KeymapInfo(
|
|
4313
|
+
this._keymapInfos.push(...( (keymapInfos.map(info => (( (new KeymapInfo(
|
|
4311
4314
|
info.layout,
|
|
4312
4315
|
info.secondaryLayouts,
|
|
4313
4316
|
info.mapping,
|
|
4314
4317
|
info.isUserKeyboardLayout
|
|
4315
|
-
))))));
|
|
4318
|
+
))))))));
|
|
4316
4319
|
this._mru = this._keymapInfos;
|
|
4317
4320
|
this._initialized = true;
|
|
4318
4321
|
this.setLayoutFromBrowserAPI();
|
|
@@ -4495,10 +4498,10 @@ if (provider != null) {
|
|
|
4495
4498
|
provider.ctor = class extends CommandsQuickAccessProvider {
|
|
4496
4499
|
get defaultFilterValue() { return undefined; }
|
|
4497
4500
|
async getCommandPicks(token) {
|
|
4498
|
-
return (await super.getCommandPicks(token)).map(pick => {
|
|
4501
|
+
return ( (await super.getCommandPicks(token)).map(pick => {
|
|
4499
4502
|
pick.buttons = [];
|
|
4500
4503
|
return pick;
|
|
4501
|
-
});
|
|
4504
|
+
}));
|
|
4502
4505
|
}
|
|
4503
4506
|
};
|
|
4504
4507
|
}
|
|
@@ -4531,22 +4534,6 @@ configurationRegistry$2.registerConfiguration({
|
|
|
4531
4534
|
}
|
|
4532
4535
|
}
|
|
4533
4536
|
});
|
|
4534
|
-
const keybindingsExtensionPoint = getExtensionPoint('keybindings');
|
|
4535
|
-
const commandsExtensionPoint = getExtensionPoint('commands');
|
|
4536
|
-
function setKeybindings(grammars, extension = Services.get().extension ?? DEFAULT_EXTENSION) {
|
|
4537
|
-
keybindingsExtensionPoint.acceptUsers([{
|
|
4538
|
-
description: extension,
|
|
4539
|
-
value: grammars,
|
|
4540
|
-
collector: new ExtensionMessageCollector(consoleExtensionMessageHandler, extension, keybindingsExtensionPoint.name)
|
|
4541
|
-
}]);
|
|
4542
|
-
}
|
|
4543
|
-
function setCommands(keybindings, extension = Services.get().extension ?? DEFAULT_EXTENSION) {
|
|
4544
|
-
commandsExtensionPoint.acceptUsers([{
|
|
4545
|
-
description: extension,
|
|
4546
|
-
value: keybindings,
|
|
4547
|
-
collector: new ExtensionMessageCollector(consoleExtensionMessageHandler, extension, keybindingsExtensionPoint.name)
|
|
4548
|
-
}]);
|
|
4549
|
-
}
|
|
4550
4537
|
async function updateUserKeybindings(keybindingsJson) {
|
|
4551
4538
|
const userDataProfilesService = StandaloneServices.get(IUserDataProfilesService);
|
|
4552
4539
|
await StandaloneServices.get(IFileService).writeFile(userDataProfilesService.defaultProfile.keybindingsResource, VSBuffer.fromString(keybindingsJson));
|
|
@@ -4559,4 +4546,4 @@ function getServiceOverride() {
|
|
|
4559
4546
|
[( IKeyboardLayoutService.toString())]: new SyncDescriptor(BrowserKeyboardLayoutService)
|
|
4560
4547
|
};
|
|
4561
4548
|
}
|
|
4562
|
-
export { getServiceOverride as default,
|
|
4549
|
+
export { getServiceOverride as default, updateUserKeybindings };
|