@codingame/monaco-vscode-keybindings-service-override 11.1.2 → 12.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.
- package/index.d.ts +19 -2
- package/index.js +110 -1
- package/package.json +21 -8
- package/vscode/src/vs/platform/keyboardLayout/common/keyboardConfig.d.ts +10 -0
- package/vscode/src/vs/platform/keyboardLayout/common/keyboardConfig.js +18 -12
- package/vscode/src/vs/platform/keyboardLayout/common/keyboardMapper.d.ts +15 -0
- package/vscode/src/vs/platform/keyboardLayout/common/keyboardMapper.js +2 -0
- package/vscode/src/vs/workbench/browser/contextkeys.d.ts +67 -0
- package/vscode/src/vs/workbench/browser/contextkeys.js +17 -16
- package/vscode/src/vs/workbench/contrib/commands/common/commands.contribution.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/commands/common/commands.contribution.js +6 -5
- package/vscode/src/vs/workbench/contrib/keybindings/browser/keybindings.contribution.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/keybindings/browser/keybindings.contribution.js +2 -1
- package/vscode/src/vs/workbench/contrib/preferences/browser/keybindingsEditorContribution.d.ts +14 -0
- package/vscode/src/vs/workbench/contrib/preferences/browser/keybindingsEditorContribution.js +27 -26
- package/vscode/src/vs/workbench/contrib/preferences/common/smartSnippetInserter.d.ts +12 -0
- package/vscode/src/vs/workbench/contrib/preferences/common/smartSnippetInserter.js +14 -13
- package/vscode/src/vs/workbench/services/actions/common/menusExtensionPoint.d.ts +44 -0
- package/vscode/src/vs/workbench/services/actions/common/menusExtensionPoint.js +183 -159
- package/vscode/src/vs/workbench/services/commands/common/commandService.d.ts +23 -0
- package/vscode/src/vs/workbench/services/commands/common/commandService.js +3 -1
- package/vscode/src/vs/workbench/services/keybinding/browser/keybindingService.d.ts +58 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keybindingService.js +130 -129
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayoutService.d.ts +69 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayoutService.js +37 -45
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/_.contribution.d.ts +8 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/_.contribution.js +2 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/cz.win.d.ts +1 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/cz.win.js +1 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/de-swiss.win.d.ts +1 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/de-swiss.win.js +1 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/de.darwin.d.ts +1 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/de.darwin.js +1 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/de.linux.d.ts +1 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/de.linux.js +1 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/de.win.d.ts +1 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/de.win.js +1 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/dk.win.d.ts +1 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/dk.win.js +1 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/dvorak.darwin.d.ts +1 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/dvorak.darwin.js +1 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/en-belgian.win.d.ts +1 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/en-belgian.win.js +1 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/en-ext.darwin.d.ts +1 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/en-ext.darwin.js +1 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/en-in.win.d.ts +1 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/en-in.win.js +1 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/en-intl.darwin.d.ts +1 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/en-intl.darwin.js +1 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/en-intl.win.d.ts +1 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/en-intl.win.js +1 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/en-uk.darwin.d.ts +1 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/en-uk.darwin.js +1 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/en-uk.win.d.ts +1 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/en-uk.win.js +1 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/en.darwin.d.ts +1 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/en.darwin.js +1 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/en.linux.d.ts +1 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/en.linux.js +1 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/en.win.d.ts +1 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/en.win.js +1 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/es-latin.win.d.ts +1 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/es-latin.win.js +1 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/es.darwin.d.ts +1 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/es.darwin.js +1 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/es.linux.d.ts +1 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/es.linux.js +1 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/es.win.d.ts +1 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/es.win.js +1 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/fr.darwin.d.ts +1 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/fr.darwin.js +1 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/fr.linux.d.ts +1 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/fr.linux.js +1 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/fr.win.d.ts +1 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/fr.win.js +1 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/hu.win.d.ts +1 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/hu.win.js +1 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/it.darwin.d.ts +1 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/it.darwin.js +1 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/it.win.d.ts +1 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/it.win.js +1 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/jp-roman.darwin.d.ts +1 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/jp-roman.darwin.js +1 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/jp.darwin.d.ts +1 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/jp.darwin.js +1 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/ko.darwin.d.ts +1 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/ko.darwin.js +1 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/layout.contribution.darwin.d.ts +1 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/layout.contribution.darwin.js +1 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/layout.contribution.linux.d.ts +1 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/layout.contribution.linux.js +1 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/layout.contribution.win.d.ts +1 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/layout.contribution.win.js +1 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/no.win.d.ts +1 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/no.win.js +1 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/pl.darwin.d.ts +1 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/pl.darwin.js +1 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/pl.win.d.ts +1 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/pl.win.js +1 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/pt-br.win.d.ts +1 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/pt-br.win.js +1 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/pt.darwin.d.ts +1 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/pt.darwin.js +1 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/pt.win.d.ts +1 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/pt.win.js +1 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/ru.darwin.d.ts +1 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/ru.darwin.js +1 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/ru.linux.d.ts +1 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/ru.linux.js +1 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/ru.win.d.ts +1 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/ru.win.js +1 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/sv.win.d.ts +1 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/sv.win.js +1 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/thai.win.d.ts +1 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/thai.win.js +1 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/tr.win.d.ts +1 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/tr.win.js +1 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/zh-hans.darwin.d.ts +1 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/zh-hans.darwin.js +1 -0
- package/vscode/src/vs/workbench/services/keybinding/common/keybindingIO.d.ts +21 -0
- package/vscode/src/vs/workbench/services/keybinding/common/keybindingIO.js +2 -1
- package/vscode/src/vs/workbench/services/keybinding/common/keymapInfo.d.ts +35 -0
- package/vscode/src/vs/workbench/services/keybinding/common/keymapInfo.js +2 -1
- package/vscode/src/vs/workbench/services/keybinding/common/macLinuxKeyboardMapper.d.ts +43 -0
- package/vscode/src/vs/workbench/services/keybinding/common/macLinuxKeyboardMapper.js +176 -178
- package/vscode/src/vs/workbench/services/keybinding/common/windowsKeyboardMapper.d.ts +49 -0
- package/vscode/src/vs/workbench/services/keybinding/common/windowsKeyboardMapper.js +71 -68
- package/keybindings.js +0 -108
|
@@ -1,19 +1,20 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6';
|
|
2
3
|
import { localize } from 'vscode/vscode/vs/nls';
|
|
3
4
|
import { onDidChangeFullscreen, isFullscreen } from 'vscode/vscode/vs/base/browser/browser';
|
|
4
|
-
import { BrowserFeatures } from 'vscode/vscode/vs/base/browser/canIUse';
|
|
5
|
+
import { BrowserFeatures, KeyboardSupport } from 'vscode/vscode/vs/base/browser/canIUse';
|
|
5
6
|
import { onDidRegisterWindow, addDisposableListener, EventType, trackFocus, getWindow } from 'vscode/vscode/vs/base/browser/dom';
|
|
6
7
|
import { StandardKeyboardEvent, printKeyboardEvent, printStandardKeyboardEvent } from 'vscode/vscode/vs/base/browser/keyboardEvent';
|
|
7
8
|
import { DeferredPromise, RunOnceScheduler } from 'vscode/vscode/vs/base/common/async';
|
|
8
9
|
import { Event, Emitter } from 'vscode/vscode/vs/base/common/event';
|
|
9
10
|
import { parse } from 'vscode/vscode/vs/base/common/json';
|
|
10
11
|
import { UserSettingsLabelProvider } from 'vscode/vscode/vs/base/common/keybindingLabels';
|
|
11
|
-
import { KeybindingParser } from 'vscode/vscode/vs/base/common/keybindingParser';
|
|
12
|
+
import { KeybindingParser } from '@codingame/monaco-vscode-2a22c7b4-b906-5914-8cd1-3ed912fb738f-common/vscode/vs/base/common/keybindingParser';
|
|
12
13
|
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';
|
|
14
|
+
import { ScanCode, KeyCode, KeyCodeUtils, ScanCodeUtils, KeyMod, IMMUTABLE_CODE_TO_KEY_CODE } from 'vscode/vscode/vs/base/common/keyCodes';
|
|
14
15
|
import { DisposableStore, Disposable } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
15
16
|
import { equals } from 'vscode/vscode/vs/base/common/objects';
|
|
16
|
-
import { OS, isMacintosh } from 'vscode/vscode/vs/base/common/platform';
|
|
17
|
+
import { OS, OperatingSystem, isMacintosh } from 'vscode/vscode/vs/base/common/platform';
|
|
17
18
|
import { dirname } from 'vscode/vscode/vs/base/common/resources';
|
|
18
19
|
import { mainWindow } from 'vscode/vscode/vs/base/browser/window';
|
|
19
20
|
import { MenuRegistry } from 'vscode/vscode/vs/platform/actions/common/actions';
|
|
@@ -21,12 +22,14 @@ import { CommandsRegistry } from 'vscode/vscode/vs/platform/commands/common/comm
|
|
|
21
22
|
import { ICommandService } from 'vscode/vscode/vs/platform/commands/common/commands.service';
|
|
22
23
|
import { ContextKeyExpr } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
|
|
23
24
|
import { IContextKeyService } from 'vscode/vscode/vs/platform/contextkey/common/contextkey.service';
|
|
25
|
+
import { FileOperation } from 'vscode/vscode/vs/platform/files/common/files';
|
|
24
26
|
import { IFileService } from 'vscode/vscode/vs/platform/files/common/files.service';
|
|
27
|
+
import 'vscode/vscode/vs/platform/instantiation/common/extensions';
|
|
25
28
|
import { Extensions } from 'vscode/vscode/vs/platform/jsonschemas/common/jsonContributionRegistry';
|
|
26
29
|
import { AbstractKeybindingService } from 'vscode/vscode/vs/platform/keybinding/common/abstractKeybindingService';
|
|
27
30
|
import 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
28
31
|
import { KeybindingResolver } from 'vscode/vscode/vs/platform/keybinding/common/keybindingResolver';
|
|
29
|
-
import { KeybindingsRegistry } from 'vscode/vscode/vs/platform/keybinding/common/keybindingsRegistry';
|
|
32
|
+
import { KeybindingsRegistry, KeybindingWeight } from 'vscode/vscode/vs/platform/keybinding/common/keybindingsRegistry';
|
|
30
33
|
import { ResolvedKeybindingItem } from 'vscode/vscode/vs/platform/keybinding/common/resolvedKeybindingItem';
|
|
31
34
|
import { IKeyboardLayoutService } from 'vscode/vscode/vs/platform/keyboardLayout/common/keyboardLayout.service';
|
|
32
35
|
import { ILogService } from 'vscode/vscode/vs/platform/log/common/log.service';
|
|
@@ -39,42 +42,46 @@ import { commandsExtensionPoint } from '../../actions/common/menusExtensionPoint
|
|
|
39
42
|
import { IExtensionService } from 'vscode/vscode/vs/workbench/services/extensions/common/extensions.service';
|
|
40
43
|
import { ExtensionsRegistry } from 'vscode/vscode/vs/workbench/services/extensions/common/extensionsRegistry';
|
|
41
44
|
import { IHostService } from 'vscode/vscode/vs/workbench/services/host/browser/host.service';
|
|
42
|
-
import { getAllUnboundCommands } from 'vscode/vscode/vs/workbench/services/keybinding/browser/unboundCommands';
|
|
45
|
+
import { getAllUnboundCommands } from '@codingame/monaco-vscode-d609a7d3-bf87-551a-884f-550a8b327ec5-common/vscode/vs/workbench/services/keybinding/browser/unboundCommands';
|
|
43
46
|
import { OutputBuilder, KeybindingIO } from '../common/keybindingIO.js';
|
|
44
47
|
import { IUserDataProfileService } from 'vscode/vscode/vs/workbench/services/userDataProfile/common/userDataProfile.service';
|
|
45
48
|
|
|
46
49
|
var WorkbenchKeybindingService_1;
|
|
47
50
|
function isValidContributedKeyBinding(keyBinding, rejects) {
|
|
48
51
|
if (!keyBinding) {
|
|
49
|
-
rejects.push(( localize(
|
|
52
|
+
rejects.push(( localize(11589, "expected non-empty value.")));
|
|
50
53
|
return false;
|
|
51
54
|
}
|
|
52
55
|
if (typeof keyBinding.command !== 'string') {
|
|
53
56
|
rejects.push(( localize(
|
|
54
|
-
|
|
57
|
+
11590,
|
|
55
58
|
"property `{0}` is mandatory and must be of type `string`",
|
|
56
59
|
'command'
|
|
57
60
|
)));
|
|
58
61
|
return false;
|
|
59
62
|
}
|
|
60
63
|
if (keyBinding.key && typeof keyBinding.key !== 'string') {
|
|
61
|
-
rejects.push(( localize(
|
|
64
|
+
rejects.push(( localize(11591, "property `{0}` can be omitted or must be of type `string`", 'key')));
|
|
62
65
|
return false;
|
|
63
66
|
}
|
|
64
67
|
if (keyBinding.when && typeof keyBinding.when !== 'string') {
|
|
65
|
-
rejects.push(( localize(
|
|
68
|
+
rejects.push(( localize(11591, "property `{0}` can be omitted or must be of type `string`", 'when')));
|
|
66
69
|
return false;
|
|
67
70
|
}
|
|
68
71
|
if (keyBinding.mac && typeof keyBinding.mac !== 'string') {
|
|
69
|
-
rejects.push(( localize(
|
|
72
|
+
rejects.push(( localize(11591, "property `{0}` can be omitted or must be of type `string`", 'mac')));
|
|
70
73
|
return false;
|
|
71
74
|
}
|
|
72
75
|
if (keyBinding.linux && typeof keyBinding.linux !== 'string') {
|
|
73
|
-
rejects.push(( localize(
|
|
76
|
+
rejects.push(( localize(
|
|
77
|
+
11591,
|
|
78
|
+
"property `{0}` can be omitted or must be of type `string`",
|
|
79
|
+
'linux'
|
|
80
|
+
)));
|
|
74
81
|
return false;
|
|
75
82
|
}
|
|
76
83
|
if (keyBinding.win && typeof keyBinding.win !== 'string') {
|
|
77
|
-
rejects.push(( localize(
|
|
84
|
+
rejects.push(( localize(11591, "property `{0}` can be omitted or must be of type `string`", 'win')));
|
|
78
85
|
return false;
|
|
79
86
|
}
|
|
80
87
|
return true;
|
|
@@ -84,33 +91,33 @@ const keybindingType = {
|
|
|
84
91
|
default: { command: '', key: '' },
|
|
85
92
|
properties: {
|
|
86
93
|
command: {
|
|
87
|
-
description: ( localize(
|
|
94
|
+
description: ( localize(11592, 'Identifier of the command to run when keybinding is triggered.')),
|
|
88
95
|
type: 'string'
|
|
89
96
|
},
|
|
90
97
|
args: {
|
|
91
|
-
description: ( localize(
|
|
98
|
+
description: ( localize(11593, "Arguments to pass to the command to execute."))
|
|
92
99
|
},
|
|
93
100
|
key: {
|
|
94
101
|
description: ( localize(
|
|
95
|
-
|
|
102
|
+
11594,
|
|
96
103
|
'Key or key sequence (separate keys with plus-sign and sequences with space, e.g. Ctrl+O and Ctrl+L L for a chord).'
|
|
97
104
|
)),
|
|
98
105
|
type: 'string'
|
|
99
106
|
},
|
|
100
107
|
mac: {
|
|
101
|
-
description: ( localize(
|
|
108
|
+
description: ( localize(11595, 'Mac specific key or key sequence.')),
|
|
102
109
|
type: 'string'
|
|
103
110
|
},
|
|
104
111
|
linux: {
|
|
105
|
-
description: ( localize(
|
|
112
|
+
description: ( localize(11596, 'Linux specific key or key sequence.')),
|
|
106
113
|
type: 'string'
|
|
107
114
|
},
|
|
108
115
|
win: {
|
|
109
|
-
description: ( localize(
|
|
116
|
+
description: ( localize(11597, 'Windows specific key or key sequence.')),
|
|
110
117
|
type: 'string'
|
|
111
118
|
},
|
|
112
119
|
when: {
|
|
113
|
-
description: ( localize(
|
|
120
|
+
description: ( localize(11598, 'Condition when the key is active.')),
|
|
114
121
|
type: 'string'
|
|
115
122
|
},
|
|
116
123
|
}
|
|
@@ -119,7 +126,7 @@ const keybindingsExtPoint = ExtensionsRegistry.registerExtensionPoint({
|
|
|
119
126
|
extensionPoint: 'keybindings',
|
|
120
127
|
deps: [commandsExtensionPoint],
|
|
121
128
|
jsonSchema: {
|
|
122
|
-
description: ( localize(
|
|
129
|
+
description: ( localize(11599, "Contributes keybindings.")),
|
|
123
130
|
oneOf: [
|
|
124
131
|
keybindingType,
|
|
125
132
|
{
|
|
@@ -130,33 +137,33 @@ const keybindingsExtPoint = ExtensionsRegistry.registerExtensionPoint({
|
|
|
130
137
|
}
|
|
131
138
|
});
|
|
132
139
|
const NUMPAD_PRINTABLE_SCANCODES = [
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
140
|
+
ScanCode.NumpadDivide,
|
|
141
|
+
ScanCode.NumpadMultiply,
|
|
142
|
+
ScanCode.NumpadSubtract,
|
|
143
|
+
ScanCode.NumpadAdd,
|
|
144
|
+
ScanCode.Numpad1,
|
|
145
|
+
ScanCode.Numpad2,
|
|
146
|
+
ScanCode.Numpad3,
|
|
147
|
+
ScanCode.Numpad4,
|
|
148
|
+
ScanCode.Numpad5,
|
|
149
|
+
ScanCode.Numpad6,
|
|
150
|
+
ScanCode.Numpad7,
|
|
151
|
+
ScanCode.Numpad8,
|
|
152
|
+
ScanCode.Numpad9,
|
|
153
|
+
ScanCode.Numpad0,
|
|
154
|
+
ScanCode.NumpadDecimal
|
|
148
155
|
];
|
|
149
|
-
const otherMacNumpadMapping = (
|
|
150
|
-
otherMacNumpadMapping.set(
|
|
151
|
-
otherMacNumpadMapping.set(
|
|
152
|
-
otherMacNumpadMapping.set(
|
|
153
|
-
otherMacNumpadMapping.set(
|
|
154
|
-
otherMacNumpadMapping.set(
|
|
155
|
-
otherMacNumpadMapping.set(
|
|
156
|
-
otherMacNumpadMapping.set(
|
|
157
|
-
otherMacNumpadMapping.set(
|
|
158
|
-
otherMacNumpadMapping.set(
|
|
159
|
-
otherMacNumpadMapping.set(
|
|
156
|
+
const otherMacNumpadMapping = ( new Map());
|
|
157
|
+
otherMacNumpadMapping.set(ScanCode.Numpad1, KeyCode.Digit1);
|
|
158
|
+
otherMacNumpadMapping.set(ScanCode.Numpad2, KeyCode.Digit2);
|
|
159
|
+
otherMacNumpadMapping.set(ScanCode.Numpad3, KeyCode.Digit3);
|
|
160
|
+
otherMacNumpadMapping.set(ScanCode.Numpad4, KeyCode.Digit4);
|
|
161
|
+
otherMacNumpadMapping.set(ScanCode.Numpad5, KeyCode.Digit5);
|
|
162
|
+
otherMacNumpadMapping.set(ScanCode.Numpad6, KeyCode.Digit6);
|
|
163
|
+
otherMacNumpadMapping.set(ScanCode.Numpad7, KeyCode.Digit7);
|
|
164
|
+
otherMacNumpadMapping.set(ScanCode.Numpad8, KeyCode.Digit8);
|
|
165
|
+
otherMacNumpadMapping.set(ScanCode.Numpad9, KeyCode.Digit9);
|
|
166
|
+
otherMacNumpadMapping.set(ScanCode.Numpad0, KeyCode.Digit0);
|
|
160
167
|
let WorkbenchKeybindingService = WorkbenchKeybindingService_1 = class WorkbenchKeybindingService extends AbstractKeybindingService {
|
|
161
168
|
constructor(contextKeyService, commandService, telemetryService, notificationService, userDataProfileService, hostService, extensionService, fileService, uriIdentityService, logService, keyboardLayoutService) {
|
|
162
169
|
super(contextKeyService, commandService, telemetryService, notificationService, logService);
|
|
@@ -164,7 +171,7 @@ let WorkbenchKeybindingService = WorkbenchKeybindingService_1 = class WorkbenchK
|
|
|
164
171
|
this.keyboardLayoutService = keyboardLayoutService;
|
|
165
172
|
this._contributions = [];
|
|
166
173
|
this.isComposingGlobalContextKey = contextKeyService.createKey('isComposing', false);
|
|
167
|
-
this.kbsJsonSchema = (
|
|
174
|
+
this.kbsJsonSchema = ( new KeybindingsJsonSchema());
|
|
168
175
|
this.updateKeybindingsJsonSchema();
|
|
169
176
|
this._keyboardMapper = this.keyboardLayoutService.getKeyboardMapper();
|
|
170
177
|
this._register(this.keyboardLayoutService.onDidChangeKeyboardLayout(() => {
|
|
@@ -173,7 +180,7 @@ let WorkbenchKeybindingService = WorkbenchKeybindingService_1 = class WorkbenchK
|
|
|
173
180
|
}));
|
|
174
181
|
this._keybindingHoldMode = null;
|
|
175
182
|
this._cachedResolver = null;
|
|
176
|
-
this.userKeybindings = this._register((
|
|
183
|
+
this.userKeybindings = this._register(( new UserKeybindings(userDataProfileService, uriIdentityService, fileService, logService)));
|
|
177
184
|
this.userKeybindings.initialize().then(() => {
|
|
178
185
|
if (this.userKeybindings.keybindings.length) {
|
|
179
186
|
this.updateResolver();
|
|
@@ -199,7 +206,7 @@ let WorkbenchKeybindingService = WorkbenchKeybindingService_1 = class WorkbenchK
|
|
|
199
206
|
return;
|
|
200
207
|
}
|
|
201
208
|
const keyboard = navigator.keyboard;
|
|
202
|
-
if (BrowserFeatures.keyboard ===
|
|
209
|
+
if (BrowserFeatures.keyboard === KeyboardSupport.None) {
|
|
203
210
|
return;
|
|
204
211
|
}
|
|
205
212
|
if (isFullscreen(mainWindow)) {
|
|
@@ -213,13 +220,13 @@ let WorkbenchKeybindingService = WorkbenchKeybindingService_1 = class WorkbenchK
|
|
|
213
220
|
}));
|
|
214
221
|
}
|
|
215
222
|
_registerKeyListeners(window) {
|
|
216
|
-
const disposables = (
|
|
223
|
+
const disposables = ( new DisposableStore());
|
|
217
224
|
disposables.add(addDisposableListener(window, EventType.KEY_DOWN, (e) => {
|
|
218
225
|
if (this._keybindingHoldMode) {
|
|
219
226
|
return;
|
|
220
227
|
}
|
|
221
228
|
this.isComposingGlobalContextKey.set(e.isComposing);
|
|
222
|
-
const keyEvent = (
|
|
229
|
+
const keyEvent = ( new StandardKeyboardEvent(e));
|
|
223
230
|
this._log(`/ Received keydown event - ${printKeyboardEvent(e)}`);
|
|
224
231
|
this._log(`| Converted keydown event - ${printStandardKeyboardEvent(keyEvent)}`);
|
|
225
232
|
const shouldPreventDefault = this._dispatch(keyEvent, keyEvent.target);
|
|
@@ -231,7 +238,7 @@ let WorkbenchKeybindingService = WorkbenchKeybindingService_1 = class WorkbenchK
|
|
|
231
238
|
disposables.add(addDisposableListener(window, EventType.KEY_UP, (e) => {
|
|
232
239
|
this._resetKeybindingHoldMode();
|
|
233
240
|
this.isComposingGlobalContextKey.set(e.isComposing);
|
|
234
|
-
const keyEvent = (
|
|
241
|
+
const keyEvent = ( new StandardKeyboardEvent(e));
|
|
235
242
|
const shouldPreventDefault = this._singleModifierDispatch(keyEvent, keyEvent.target);
|
|
236
243
|
if (shouldPreventDefault) {
|
|
237
244
|
keyEvent.preventDefault();
|
|
@@ -253,17 +260,13 @@ let WorkbenchKeybindingService = WorkbenchKeybindingService_1 = class WorkbenchK
|
|
|
253
260
|
_printKeybinding(keybinding) {
|
|
254
261
|
return UserSettingsLabelProvider.toLabel(OS, keybinding.chords, (chord) => {
|
|
255
262
|
if (chord instanceof KeyCodeChord) {
|
|
256
|
-
return (
|
|
257
|
-
(KeyCodeUtils.toString(chord.keyCode))
|
|
258
|
-
);
|
|
263
|
+
return ( KeyCodeUtils.toString(chord.keyCode));
|
|
259
264
|
}
|
|
260
|
-
return (
|
|
261
|
-
(ScanCodeUtils.toString(chord.scanCode))
|
|
262
|
-
);
|
|
265
|
+
return ( ScanCodeUtils.toString(chord.scanCode));
|
|
263
266
|
}) || '[null]';
|
|
264
267
|
}
|
|
265
268
|
_printResolvedKeybinding(resolvedKeybinding) {
|
|
266
|
-
return (
|
|
269
|
+
return ( resolvedKeybinding.getDispatchChords().map(x => x || '[null]')).join(' ');
|
|
267
270
|
}
|
|
268
271
|
_printResolvedKeybindings(output, input, resolvedKeybindings) {
|
|
269
272
|
const padLength = 35;
|
|
@@ -279,7 +282,7 @@ let WorkbenchKeybindingService = WorkbenchKeybindingService_1 = class WorkbenchK
|
|
|
279
282
|
}
|
|
280
283
|
}
|
|
281
284
|
_dumpResolveKeybindingDebugInfo() {
|
|
282
|
-
const seenBindings = (
|
|
285
|
+
const seenBindings = ( new Set());
|
|
283
286
|
const result = [];
|
|
284
287
|
result.push(`Default Resolved Keybindings (unique only):`);
|
|
285
288
|
for (const item of KeybindingsRegistry.getDefaultKeybindings()) {
|
|
@@ -287,7 +290,7 @@ let WorkbenchKeybindingService = WorkbenchKeybindingService_1 = class WorkbenchK
|
|
|
287
290
|
continue;
|
|
288
291
|
}
|
|
289
292
|
const input = this._printKeybinding(item.keybinding);
|
|
290
|
-
if ((
|
|
293
|
+
if (( seenBindings.has(input))) {
|
|
291
294
|
continue;
|
|
292
295
|
}
|
|
293
296
|
seenBindings.add(input);
|
|
@@ -300,7 +303,7 @@ let WorkbenchKeybindingService = WorkbenchKeybindingService_1 = class WorkbenchK
|
|
|
300
303
|
continue;
|
|
301
304
|
}
|
|
302
305
|
const input = item._sourceKey ?? 'Impossible: missing source key, but has keybinding';
|
|
303
|
-
if ((
|
|
306
|
+
if (( seenBindings.has(input))) {
|
|
304
307
|
continue;
|
|
305
308
|
}
|
|
306
309
|
seenBindings.add(input);
|
|
@@ -327,7 +330,7 @@ let WorkbenchKeybindingService = WorkbenchKeybindingService_1 = class WorkbenchK
|
|
|
327
330
|
if (this._currentlyDispatchingCommandId !== commandId) {
|
|
328
331
|
return undefined;
|
|
329
332
|
}
|
|
330
|
-
this._keybindingHoldMode = (
|
|
333
|
+
this._keybindingHoldMode = ( new DeferredPromise());
|
|
331
334
|
const focusTracker = trackFocus(getWindow(undefined));
|
|
332
335
|
const listener = focusTracker.onDidBlur(() => this._resetKeybindingHoldMode());
|
|
333
336
|
this._keybindingHoldMode.p.finally(() => {
|
|
@@ -357,7 +360,7 @@ let WorkbenchKeybindingService = WorkbenchKeybindingService_1 = class WorkbenchK
|
|
|
357
360
|
if (!this._cachedResolver) {
|
|
358
361
|
const defaults = this._resolveKeybindingItems(KeybindingsRegistry.getDefaultKeybindings(), true);
|
|
359
362
|
const overrides = this.getUserKeybindingItems();
|
|
360
|
-
this._cachedResolver = (
|
|
363
|
+
this._cachedResolver = ( new KeybindingResolver(defaults, overrides, (str) => this._log(str)));
|
|
361
364
|
}
|
|
362
365
|
return this._cachedResolver;
|
|
363
366
|
}
|
|
@@ -371,7 +374,7 @@ let WorkbenchKeybindingService = WorkbenchKeybindingService_1 = class WorkbenchK
|
|
|
371
374
|
const when = item.when || undefined;
|
|
372
375
|
const keybinding = item.keybinding;
|
|
373
376
|
if (!keybinding) {
|
|
374
|
-
result[resultLen++] = (
|
|
377
|
+
result[resultLen++] = ( new ResolvedKeybindingItem(
|
|
375
378
|
undefined,
|
|
376
379
|
item.command,
|
|
377
380
|
item.commandArgs,
|
|
@@ -379,7 +382,7 @@ let WorkbenchKeybindingService = WorkbenchKeybindingService_1 = class WorkbenchK
|
|
|
379
382
|
isDefault,
|
|
380
383
|
item.extensionId,
|
|
381
384
|
item.isBuiltinExtension
|
|
382
|
-
))
|
|
385
|
+
));
|
|
383
386
|
}
|
|
384
387
|
else {
|
|
385
388
|
if (this._assertBrowserConflicts(keybinding)) {
|
|
@@ -388,7 +391,7 @@ let WorkbenchKeybindingService = WorkbenchKeybindingService_1 = class WorkbenchK
|
|
|
388
391
|
const resolvedKeybindings = this._keyboardMapper.resolveKeybinding(keybinding);
|
|
389
392
|
for (let i = resolvedKeybindings.length - 1; i >= 0; i--) {
|
|
390
393
|
const resolvedKeybinding = resolvedKeybindings[i];
|
|
391
|
-
result[resultLen++] = (
|
|
394
|
+
result[resultLen++] = ( new ResolvedKeybindingItem(
|
|
392
395
|
resolvedKeybinding,
|
|
393
396
|
item.command,
|
|
394
397
|
item.commandArgs,
|
|
@@ -396,7 +399,7 @@ let WorkbenchKeybindingService = WorkbenchKeybindingService_1 = class WorkbenchK
|
|
|
396
399
|
isDefault,
|
|
397
400
|
item.extensionId,
|
|
398
401
|
item.isBuiltinExtension
|
|
399
|
-
))
|
|
402
|
+
));
|
|
400
403
|
}
|
|
401
404
|
}
|
|
402
405
|
}
|
|
@@ -408,12 +411,12 @@ let WorkbenchKeybindingService = WorkbenchKeybindingService_1 = class WorkbenchK
|
|
|
408
411
|
for (const item of items) {
|
|
409
412
|
const when = item.when || undefined;
|
|
410
413
|
if (!item.keybinding) {
|
|
411
|
-
result[resultLen++] = (
|
|
414
|
+
result[resultLen++] = ( new ResolvedKeybindingItem(undefined, item.command, item.commandArgs, when, isDefault, null, false));
|
|
412
415
|
}
|
|
413
416
|
else {
|
|
414
417
|
const resolvedKeybindings = this._keyboardMapper.resolveKeybinding(item.keybinding);
|
|
415
418
|
for (const resolvedKeybinding of resolvedKeybindings) {
|
|
416
|
-
result[resultLen++] = (
|
|
419
|
+
result[resultLen++] = ( new ResolvedKeybindingItem(
|
|
417
420
|
resolvedKeybinding,
|
|
418
421
|
item.command,
|
|
419
422
|
item.commandArgs,
|
|
@@ -421,50 +424,50 @@ let WorkbenchKeybindingService = WorkbenchKeybindingService_1 = class WorkbenchK
|
|
|
421
424
|
isDefault,
|
|
422
425
|
null,
|
|
423
426
|
false
|
|
424
|
-
))
|
|
427
|
+
));
|
|
425
428
|
}
|
|
426
429
|
}
|
|
427
430
|
}
|
|
428
431
|
return result;
|
|
429
432
|
}
|
|
430
433
|
_assertBrowserConflicts(keybinding) {
|
|
431
|
-
if (BrowserFeatures.keyboard ===
|
|
434
|
+
if (BrowserFeatures.keyboard === KeyboardSupport.Always) {
|
|
432
435
|
return false;
|
|
433
436
|
}
|
|
434
|
-
if (BrowserFeatures.keyboard ===
|
|
437
|
+
if (BrowserFeatures.keyboard === KeyboardSupport.FullScreen && isFullscreen(mainWindow)) {
|
|
435
438
|
return false;
|
|
436
439
|
}
|
|
437
440
|
for (const chord of keybinding.chords) {
|
|
438
441
|
if (!chord.metaKey && !chord.altKey && !chord.ctrlKey && !chord.shiftKey) {
|
|
439
442
|
continue;
|
|
440
443
|
}
|
|
441
|
-
const modifiersMask =
|
|
444
|
+
const modifiersMask = KeyMod.CtrlCmd | KeyMod.Alt | KeyMod.Shift;
|
|
442
445
|
let partModifiersMask = 0;
|
|
443
446
|
if (chord.metaKey) {
|
|
444
|
-
partModifiersMask |=
|
|
447
|
+
partModifiersMask |= KeyMod.CtrlCmd;
|
|
445
448
|
}
|
|
446
449
|
if (chord.shiftKey) {
|
|
447
|
-
partModifiersMask |=
|
|
450
|
+
partModifiersMask |= KeyMod.Shift;
|
|
448
451
|
}
|
|
449
452
|
if (chord.altKey) {
|
|
450
|
-
partModifiersMask |=
|
|
453
|
+
partModifiersMask |= KeyMod.Alt;
|
|
451
454
|
}
|
|
452
|
-
if (chord.ctrlKey && OS ===
|
|
453
|
-
partModifiersMask |=
|
|
455
|
+
if (chord.ctrlKey && OS === OperatingSystem.Macintosh) {
|
|
456
|
+
partModifiersMask |= KeyMod.WinCtrl;
|
|
454
457
|
}
|
|
455
|
-
if ((partModifiersMask & modifiersMask) === (
|
|
456
|
-
if (chord instanceof ScanCodeChord && (
|
|
458
|
+
if ((partModifiersMask & modifiersMask) === (KeyMod.CtrlCmd | KeyMod.Alt)) {
|
|
459
|
+
if (chord instanceof ScanCodeChord && (chord.scanCode === ScanCode.ArrowLeft || chord.scanCode === ScanCode.ArrowRight)) {
|
|
457
460
|
return true;
|
|
458
461
|
}
|
|
459
|
-
if (chord instanceof KeyCodeChord && (
|
|
462
|
+
if (chord instanceof KeyCodeChord && (chord.keyCode === KeyCode.LeftArrow || chord.keyCode === KeyCode.RightArrow)) {
|
|
460
463
|
return true;
|
|
461
464
|
}
|
|
462
465
|
}
|
|
463
|
-
if ((partModifiersMask & modifiersMask) ===
|
|
464
|
-
if (chord instanceof ScanCodeChord && (
|
|
466
|
+
if ((partModifiersMask & modifiersMask) === KeyMod.CtrlCmd) {
|
|
467
|
+
if (chord instanceof ScanCodeChord && (chord.scanCode >= ScanCode.Digit1 && chord.scanCode <= ScanCode.Digit0)) {
|
|
465
468
|
return true;
|
|
466
469
|
}
|
|
467
|
-
if (chord instanceof KeyCodeChord && (
|
|
470
|
+
if (chord instanceof KeyCodeChord && (chord.keyCode >= KeyCode.Digit0 && chord.keyCode <= KeyCode.Digit9)) {
|
|
468
471
|
return true;
|
|
469
472
|
}
|
|
470
473
|
}
|
|
@@ -502,7 +505,7 @@ let WorkbenchKeybindingService = WorkbenchKeybindingService_1 = class WorkbenchK
|
|
|
502
505
|
}
|
|
503
506
|
if (rejects.length > 0) {
|
|
504
507
|
collector.error(( localize(
|
|
505
|
-
|
|
508
|
+
11600,
|
|
506
509
|
"Invalid `contributes.{0}`: {1}",
|
|
507
510
|
keybindingsExtPoint.name,
|
|
508
511
|
rejects.join('\n')
|
|
@@ -510,12 +513,12 @@ let WorkbenchKeybindingService = WorkbenchKeybindingService_1 = class WorkbenchK
|
|
|
510
513
|
}
|
|
511
514
|
}
|
|
512
515
|
static bindToCurrentPlatform(key, mac, linux, win) {
|
|
513
|
-
if (OS ===
|
|
516
|
+
if (OS === OperatingSystem.Windows && win) {
|
|
514
517
|
if (win) {
|
|
515
518
|
return win;
|
|
516
519
|
}
|
|
517
520
|
}
|
|
518
|
-
else if (OS ===
|
|
521
|
+
else if (OS === OperatingSystem.Macintosh) {
|
|
519
522
|
if (mac) {
|
|
520
523
|
return mac;
|
|
521
524
|
}
|
|
@@ -535,16 +538,16 @@ let WorkbenchKeybindingService = WorkbenchKeybindingService_1 = class WorkbenchK
|
|
|
535
538
|
}
|
|
536
539
|
let weight;
|
|
537
540
|
if (isBuiltin) {
|
|
538
|
-
weight =
|
|
541
|
+
weight = KeybindingWeight.BuiltinExtension + idx;
|
|
539
542
|
}
|
|
540
543
|
else {
|
|
541
|
-
weight =
|
|
544
|
+
weight = KeybindingWeight.ExternalExtension + idx;
|
|
542
545
|
}
|
|
543
546
|
const commandAction = MenuRegistry.getCommand(command);
|
|
544
547
|
const precondition = commandAction && commandAction.precondition;
|
|
545
548
|
let fullWhen;
|
|
546
549
|
if (when && precondition) {
|
|
547
|
-
fullWhen = (
|
|
550
|
+
fullWhen = ( ContextKeyExpr.and(precondition, ContextKeyExpr.deserialize(when)));
|
|
548
551
|
}
|
|
549
552
|
else if (when) {
|
|
550
553
|
fullWhen = ContextKeyExpr.deserialize(when);
|
|
@@ -572,7 +575,7 @@ let WorkbenchKeybindingService = WorkbenchKeybindingService_1 = class WorkbenchK
|
|
|
572
575
|
+ WorkbenchKeybindingService_1._getAllCommandsAsComment(boundCommands));
|
|
573
576
|
}
|
|
574
577
|
static _getDefaultKeybindings(defaultKeybindings) {
|
|
575
|
-
const out = (
|
|
578
|
+
const out = ( new OutputBuilder());
|
|
576
579
|
out.writeLine('[');
|
|
577
580
|
const lastIndex = defaultKeybindings.length - 1;
|
|
578
581
|
defaultKeybindings.forEach((k, index) => {
|
|
@@ -585,14 +588,12 @@ let WorkbenchKeybindingService = WorkbenchKeybindingService_1 = class WorkbenchK
|
|
|
585
588
|
}
|
|
586
589
|
});
|
|
587
590
|
out.writeLine(']');
|
|
588
|
-
return (
|
|
589
|
-
(out.toString())
|
|
590
|
-
);
|
|
591
|
+
return ( out.toString());
|
|
591
592
|
}
|
|
592
593
|
static _getAllCommandsAsComment(boundCommands) {
|
|
593
594
|
const unboundCommands = getAllUnboundCommands(boundCommands);
|
|
594
595
|
const pretty = unboundCommands.sort().join('\n// - ');
|
|
595
|
-
return '// ' + ( localize(
|
|
596
|
+
return '// ' + ( localize(11601, "Here are other available commands: ")) + '\n// - ' + pretty;
|
|
596
597
|
}
|
|
597
598
|
mightProducePrintableCharacter(event) {
|
|
598
599
|
if (event.ctrlKey || event.metaKey || event.altKey) {
|
|
@@ -626,19 +627,19 @@ let WorkbenchKeybindingService = WorkbenchKeybindingService_1 = class WorkbenchK
|
|
|
626
627
|
return true;
|
|
627
628
|
}
|
|
628
629
|
};
|
|
629
|
-
WorkbenchKeybindingService = WorkbenchKeybindingService_1 = (
|
|
630
|
-
(
|
|
631
|
-
(
|
|
632
|
-
(
|
|
633
|
-
(
|
|
634
|
-
(
|
|
635
|
-
(
|
|
636
|
-
(
|
|
637
|
-
(
|
|
638
|
-
(
|
|
639
|
-
(
|
|
640
|
-
(
|
|
641
|
-
], WorkbenchKeybindingService))
|
|
630
|
+
WorkbenchKeybindingService = WorkbenchKeybindingService_1 = ( __decorate([
|
|
631
|
+
( __param(0, IContextKeyService)),
|
|
632
|
+
( __param(1, ICommandService)),
|
|
633
|
+
( __param(2, ITelemetryService)),
|
|
634
|
+
( __param(3, INotificationService)),
|
|
635
|
+
( __param(4, IUserDataProfileService)),
|
|
636
|
+
( __param(5, IHostService)),
|
|
637
|
+
( __param(6, IExtensionService)),
|
|
638
|
+
( __param(7, IFileService)),
|
|
639
|
+
( __param(8, IUriIdentityService)),
|
|
640
|
+
( __param(9, ILogService)),
|
|
641
|
+
( __param(10, IKeyboardLayoutService))
|
|
642
|
+
], WorkbenchKeybindingService));
|
|
642
643
|
class UserKeybindings extends Disposable {
|
|
643
644
|
get keybindings() { return this._keybindings; }
|
|
644
645
|
constructor(userDataProfileService, uriIdentityService, fileService, logService) {
|
|
@@ -648,21 +649,21 @@ class UserKeybindings extends Disposable {
|
|
|
648
649
|
this.fileService = fileService;
|
|
649
650
|
this._rawKeybindings = [];
|
|
650
651
|
this._keybindings = [];
|
|
651
|
-
this.watchDisposables = this._register((
|
|
652
|
-
this._onDidChange = this._register((
|
|
652
|
+
this.watchDisposables = this._register(( new DisposableStore()));
|
|
653
|
+
this._onDidChange = this._register(( new Emitter()));
|
|
653
654
|
this.onDidChange = this._onDidChange.event;
|
|
654
655
|
this.watch();
|
|
655
|
-
this.reloadConfigurationScheduler = this._register((
|
|
656
|
+
this.reloadConfigurationScheduler = this._register(( new RunOnceScheduler(() => this.reload().then(changed => {
|
|
656
657
|
if (changed) {
|
|
657
658
|
this._onDidChange.fire();
|
|
658
659
|
}
|
|
659
|
-
}), 50)))
|
|
660
|
+
}), 50)));
|
|
660
661
|
this._register(Event.filter(this.fileService.onDidFilesChange, e => e.contains(this.userDataProfileService.currentProfile.keybindingsResource))(() => {
|
|
661
662
|
logService.debug('Keybindings file changed');
|
|
662
663
|
this.reloadConfigurationScheduler.schedule();
|
|
663
664
|
}));
|
|
664
665
|
this._register(this.fileService.onDidRunOperation((e) => {
|
|
665
|
-
if (e.operation ===
|
|
666
|
+
if (e.operation === FileOperation.WRITE && ( e.resource.toString()) === ( this.userDataProfileService.currentProfile.keybindingsResource.toString())) {
|
|
666
667
|
logService.debug('Keybindings file written');
|
|
667
668
|
this.reloadConfigurationScheduler.schedule();
|
|
668
669
|
}
|
|
@@ -691,13 +692,13 @@ class UserKeybindings extends Disposable {
|
|
|
691
692
|
return false;
|
|
692
693
|
}
|
|
693
694
|
this._rawKeybindings = newKeybindings;
|
|
694
|
-
this._keybindings = (
|
|
695
|
+
this._keybindings = ( this._rawKeybindings.map((k) => KeybindingIO.readUserKeybindingItem(k)));
|
|
695
696
|
return true;
|
|
696
697
|
}
|
|
697
698
|
async readUserKeybindings() {
|
|
698
699
|
try {
|
|
699
700
|
const content = await this.fileService.readFile(this.userDataProfileService.currentProfile.keybindingsResource);
|
|
700
|
-
const value = parse((
|
|
701
|
+
const value = parse(( content.value.toString()));
|
|
701
702
|
return Array.isArray(value)
|
|
702
703
|
? value.filter(v => v && typeof v === 'object' )
|
|
703
704
|
: [];
|
|
@@ -717,7 +718,7 @@ class KeybindingsJsonSchema {
|
|
|
717
718
|
this.schema = {
|
|
718
719
|
id: KeybindingsJsonSchema.schemaId,
|
|
719
720
|
type: 'array',
|
|
720
|
-
title: ( localize(
|
|
721
|
+
title: ( localize(11602, "Keybindings configuration")),
|
|
721
722
|
allowTrailingCommas: true,
|
|
722
723
|
allowComments: true,
|
|
723
724
|
definitions: {
|
|
@@ -741,7 +742,7 @@ class KeybindingsJsonSchema {
|
|
|
741
742
|
'type': 'string',
|
|
742
743
|
'enum': this.commandsEnum,
|
|
743
744
|
'enumDescriptions': this.commandsEnumDescriptions,
|
|
744
|
-
'description': ( localize(
|
|
745
|
+
'description': ( localize(11603, "Name of the command to execute")),
|
|
745
746
|
},
|
|
746
747
|
'commandType': {
|
|
747
748
|
'anyOf': [
|
|
@@ -752,7 +753,7 @@ class KeybindingsJsonSchema {
|
|
|
752
753
|
'type': 'string',
|
|
753
754
|
'enum': this.removalCommandsEnum,
|
|
754
755
|
'enumDescriptions': this.commandsEnumDescriptions,
|
|
755
|
-
'description': ( localize(
|
|
756
|
+
'description': ( localize(11604, "Name of the command to remove keyboard shortcut for")),
|
|
756
757
|
},
|
|
757
758
|
{
|
|
758
759
|
'type': 'string'
|
|
@@ -770,7 +771,7 @@ class KeybindingsJsonSchema {
|
|
|
770
771
|
'properties': {
|
|
771
772
|
'key': {
|
|
772
773
|
'type': 'string',
|
|
773
|
-
'description': ( localize(
|
|
774
|
+
'description': ( localize(11605, "Key or key sequence (separated by space)")),
|
|
774
775
|
},
|
|
775
776
|
'command': {
|
|
776
777
|
'anyOf': [
|
|
@@ -783,7 +784,7 @@ class KeybindingsJsonSchema {
|
|
|
783
784
|
'type': 'array'
|
|
784
785
|
},
|
|
785
786
|
'errorMessage': ( localize(
|
|
786
|
-
|
|
787
|
+
11606,
|
|
787
788
|
"Incorrect type. Expected \"{0}\". The field 'command' does not support running multiple commands. Use command 'runCommands' to pass it multiple commands to run.",
|
|
788
789
|
'string'
|
|
789
790
|
))
|
|
@@ -799,16 +800,16 @@ class KeybindingsJsonSchema {
|
|
|
799
800
|
},
|
|
800
801
|
'when': {
|
|
801
802
|
'type': 'string',
|
|
802
|
-
'description': ( localize(
|
|
803
|
+
'description': ( localize(11607, "Condition when the key is active."))
|
|
803
804
|
},
|
|
804
805
|
'args': {
|
|
805
|
-
'description': ( localize(
|
|
806
|
+
'description': ( localize(11608, "Arguments to pass to the command to execute."))
|
|
806
807
|
}
|
|
807
808
|
},
|
|
808
809
|
'$ref': '#/definitions/commandsSchemas'
|
|
809
810
|
}
|
|
810
811
|
};
|
|
811
|
-
this.schemaRegistry = (
|
|
812
|
+
this.schemaRegistry = ( Registry.as(Extensions.JSONContribution));
|
|
812
813
|
this.schemaRegistry.registerSchema(KeybindingsJsonSchema.schemaId, this.schema);
|
|
813
814
|
}
|
|
814
815
|
updateSchema(additionalContributions) {
|
|
@@ -816,10 +817,10 @@ class KeybindingsJsonSchema {
|
|
|
816
817
|
this.commandsEnum.length = 0;
|
|
817
818
|
this.removalCommandsEnum.length = 0;
|
|
818
819
|
this.commandsEnumDescriptions.length = 0;
|
|
819
|
-
const knownCommands = (
|
|
820
|
+
const knownCommands = ( new Set());
|
|
820
821
|
const addKnownCommand = (commandId, description) => {
|
|
821
822
|
if (!/^_/.test(commandId)) {
|
|
822
|
-
if (!(
|
|
823
|
+
if (!( knownCommands.has(commandId))) {
|
|
823
824
|
knownCommands.add(commandId);
|
|
824
825
|
this.commandsEnum.push(commandId);
|
|
825
826
|
this.commandsEnumDescriptions.push(isLocalizedString(description) ? description.value : description);
|
|
@@ -855,7 +856,7 @@ class KeybindingsJsonSchema {
|
|
|
855
856
|
this.commandsSchemas.push(addition);
|
|
856
857
|
}
|
|
857
858
|
const menuCommands = MenuRegistry.getCommands();
|
|
858
|
-
for (const commandId of (
|
|
859
|
+
for (const commandId of ( menuCommands.keys())) {
|
|
859
860
|
addKnownCommand(commandId);
|
|
860
861
|
}
|
|
861
862
|
this.commandsSchemas.push(...additionalContributions);
|