@codingame/monaco-vscode-keybindings-service-override 34.1.3 → 35.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/package.json +3 -3
- package/vscode/src/vs/platform/keyboardLayout/common/keyboardConfig.js +3 -3
- package/vscode/src/vs/workbench/contrib/commands/common/commands.contribution.js +5 -5
- package/vscode/src/vs/workbench/contrib/keybindings/browser/keybindings.contribution.js +1 -1
- package/vscode/src/vs/workbench/contrib/preferences/browser/keybindingsEditorContribution.js +3 -3
- package/vscode/src/vs/workbench/services/actions/common/menusExtensionPoint.js +153 -153
- package/vscode/src/vs/workbench/services/keybinding/browser/keybindingService.js +44 -26
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayoutService.js +2 -2
- package/vscode/src/vs/workbench/services/keybinding/common/keybindingIO.d.ts +1 -0
- package/vscode/src/vs/workbench/services/keybinding/common/keybindingIO.js +7 -0
|
@@ -51,39 +51,39 @@ import { EditorContextKeys } from '@codingame/monaco-vscode-api/vscode/vs/editor
|
|
|
51
51
|
var WorkbenchKeybindingService_1;
|
|
52
52
|
function isValidContributedKeyBinding(keyBinding, rejects) {
|
|
53
53
|
if (!keyBinding) {
|
|
54
|
-
rejects.push(( localize(
|
|
54
|
+
rejects.push(( localize(17765, "expected non-empty value.")));
|
|
55
55
|
return false;
|
|
56
56
|
}
|
|
57
57
|
if (typeof keyBinding.command !== "string") {
|
|
58
58
|
rejects.push(( localize(
|
|
59
|
-
|
|
59
|
+
17766,
|
|
60
60
|
"property `{0}` is mandatory and must be of type `string`",
|
|
61
61
|
"command"
|
|
62
62
|
)));
|
|
63
63
|
return false;
|
|
64
64
|
}
|
|
65
65
|
if (keyBinding.key && typeof keyBinding.key !== "string") {
|
|
66
|
-
rejects.push(( localize(
|
|
66
|
+
rejects.push(( localize(17767, "property `{0}` can be omitted or must be of type `string`", "key")));
|
|
67
67
|
return false;
|
|
68
68
|
}
|
|
69
69
|
if (keyBinding.when && typeof keyBinding.when !== "string") {
|
|
70
|
-
rejects.push(( localize(
|
|
70
|
+
rejects.push(( localize(17767, "property `{0}` can be omitted or must be of type `string`", "when")));
|
|
71
71
|
return false;
|
|
72
72
|
}
|
|
73
73
|
if (keyBinding.mac && typeof keyBinding.mac !== "string") {
|
|
74
|
-
rejects.push(( localize(
|
|
74
|
+
rejects.push(( localize(17767, "property `{0}` can be omitted or must be of type `string`", "mac")));
|
|
75
75
|
return false;
|
|
76
76
|
}
|
|
77
77
|
if (keyBinding.linux && typeof keyBinding.linux !== "string") {
|
|
78
78
|
rejects.push(( localize(
|
|
79
|
-
|
|
79
|
+
17767,
|
|
80
80
|
"property `{0}` can be omitted or must be of type `string`",
|
|
81
81
|
"linux"
|
|
82
82
|
)));
|
|
83
83
|
return false;
|
|
84
84
|
}
|
|
85
85
|
if (keyBinding.win && typeof keyBinding.win !== "string") {
|
|
86
|
-
rejects.push(( localize(
|
|
86
|
+
rejects.push(( localize(17767, "property `{0}` can be omitted or must be of type `string`", "win")));
|
|
87
87
|
return false;
|
|
88
88
|
}
|
|
89
89
|
return true;
|
|
@@ -97,33 +97,33 @@ const keybindingType = {
|
|
|
97
97
|
required: ["command", "key"],
|
|
98
98
|
properties: {
|
|
99
99
|
command: {
|
|
100
|
-
description: ( localize(
|
|
100
|
+
description: ( localize(17768, "Identifier of the command to run when keybinding is triggered.")),
|
|
101
101
|
type: "string"
|
|
102
102
|
},
|
|
103
103
|
args: {
|
|
104
|
-
description: ( localize(
|
|
104
|
+
description: ( localize(17769, "Arguments to pass to the command to execute."))
|
|
105
105
|
},
|
|
106
106
|
key: {
|
|
107
107
|
description: ( localize(
|
|
108
|
-
|
|
108
|
+
17770,
|
|
109
109
|
"Key or key sequence (separate keys with plus-sign and sequences with space, e.g. Ctrl+O and Ctrl+L L for a chord)."
|
|
110
110
|
)),
|
|
111
111
|
type: "string"
|
|
112
112
|
},
|
|
113
113
|
mac: {
|
|
114
|
-
description: ( localize(
|
|
114
|
+
description: ( localize(17771, "Mac specific key or key sequence.")),
|
|
115
115
|
type: "string"
|
|
116
116
|
},
|
|
117
117
|
linux: {
|
|
118
|
-
description: ( localize(
|
|
118
|
+
description: ( localize(17772, "Linux specific key or key sequence.")),
|
|
119
119
|
type: "string"
|
|
120
120
|
},
|
|
121
121
|
win: {
|
|
122
|
-
description: ( localize(
|
|
122
|
+
description: ( localize(17773, "Windows specific key or key sequence.")),
|
|
123
123
|
type: "string"
|
|
124
124
|
},
|
|
125
125
|
when: {
|
|
126
|
-
description: ( localize(
|
|
126
|
+
description: ( localize(17774, "Condition when the key is active.")),
|
|
127
127
|
type: "string"
|
|
128
128
|
}
|
|
129
129
|
}
|
|
@@ -132,7 +132,7 @@ const keybindingsExtPoint = ExtensionsRegistry.registerExtensionPoint({
|
|
|
132
132
|
extensionPoint: "keybindings",
|
|
133
133
|
deps: [commandsExtensionPoint],
|
|
134
134
|
jsonSchema: {
|
|
135
|
-
description: ( localize(
|
|
135
|
+
description: ( localize(17775, "Contributes keybindings.")),
|
|
136
136
|
oneOf: [keybindingType, {
|
|
137
137
|
type: "array",
|
|
138
138
|
items: keybindingType
|
|
@@ -463,7 +463,16 @@ let WorkbenchKeybindingService = WorkbenchKeybindingService_1 = class WorkbenchK
|
|
|
463
463
|
for (const item of items) {
|
|
464
464
|
const when = item.when || undefined;
|
|
465
465
|
if (!item.keybinding) {
|
|
466
|
-
result[resultLen++] = ( new ResolvedKeybindingItem(
|
|
466
|
+
result[resultLen++] = ( new ResolvedKeybindingItem(
|
|
467
|
+
undefined,
|
|
468
|
+
item.command,
|
|
469
|
+
item.commandArgs,
|
|
470
|
+
when,
|
|
471
|
+
isDefault,
|
|
472
|
+
null,
|
|
473
|
+
false,
|
|
474
|
+
item.systemWide
|
|
475
|
+
));
|
|
467
476
|
} else {
|
|
468
477
|
const resolvedKeybindings = this._keyboardMapper.resolveKeybinding(item.keybinding);
|
|
469
478
|
for (const resolvedKeybinding of resolvedKeybindings) {
|
|
@@ -474,7 +483,8 @@ let WorkbenchKeybindingService = WorkbenchKeybindingService_1 = class WorkbenchK
|
|
|
474
483
|
when,
|
|
475
484
|
isDefault,
|
|
476
485
|
null,
|
|
477
|
-
false
|
|
486
|
+
false,
|
|
487
|
+
item.systemWide
|
|
478
488
|
));
|
|
479
489
|
}
|
|
480
490
|
}
|
|
@@ -555,7 +565,7 @@ let WorkbenchKeybindingService = WorkbenchKeybindingService_1 = class WorkbenchK
|
|
|
555
565
|
}
|
|
556
566
|
if (rejects.length > 0) {
|
|
557
567
|
collector.error(( localize(
|
|
558
|
-
|
|
568
|
+
17776,
|
|
559
569
|
"Invalid `contributes.{0}`: {1}",
|
|
560
570
|
keybindingsExtPoint.name,
|
|
561
571
|
rejects.join("\n")
|
|
@@ -643,7 +653,7 @@ let WorkbenchKeybindingService = WorkbenchKeybindingService_1 = class WorkbenchK
|
|
|
643
653
|
static _getAllCommandsAsComment(boundCommands) {
|
|
644
654
|
const unboundCommands = getAllUnboundCommands(boundCommands);
|
|
645
655
|
const pretty = unboundCommands.sort().join("\n// - ");
|
|
646
|
-
return "// " + ( localize(
|
|
656
|
+
return "// " + ( localize(17777, "Here are other available commands: ")) + "\n// - " + pretty;
|
|
647
657
|
}
|
|
648
658
|
mightProducePrintableCharacter(event) {
|
|
649
659
|
if (event.ctrlKey || event.metaKey || event.altKey) {
|
|
@@ -766,7 +776,7 @@ class KeybindingsJsonSchema {
|
|
|
766
776
|
this.schema = {
|
|
767
777
|
id: KeybindingsJsonSchema.schemaId,
|
|
768
778
|
type: "array",
|
|
769
|
-
title: ( localize(
|
|
779
|
+
title: ( localize(17778, "Keybindings configuration")),
|
|
770
780
|
allowTrailingCommas: true,
|
|
771
781
|
allowComments: true,
|
|
772
782
|
definitions: {
|
|
@@ -790,7 +800,7 @@ class KeybindingsJsonSchema {
|
|
|
790
800
|
"type": "string",
|
|
791
801
|
"enum": this.commandsEnum,
|
|
792
802
|
"enumDescriptions": this.commandsEnumDescriptions,
|
|
793
|
-
"description": ( localize(
|
|
803
|
+
"description": ( localize(17779, "Name of the command to execute"))
|
|
794
804
|
},
|
|
795
805
|
"commandType": {
|
|
796
806
|
"anyOf": [{
|
|
@@ -799,7 +809,7 @@ class KeybindingsJsonSchema {
|
|
|
799
809
|
"type": "string",
|
|
800
810
|
"enum": this.removalCommandsEnum,
|
|
801
811
|
"enumDescriptions": this.commandsEnumDescriptions,
|
|
802
|
-
"description": ( localize(
|
|
812
|
+
"description": ( localize(17780, "Name of the command to remove keyboard shortcut for"))
|
|
803
813
|
}, {
|
|
804
814
|
"type": "string"
|
|
805
815
|
}]
|
|
@@ -821,7 +831,7 @@ class KeybindingsJsonSchema {
|
|
|
821
831
|
"properties": {
|
|
822
832
|
"key": {
|
|
823
833
|
"type": "string",
|
|
824
|
-
"description": ( localize(
|
|
834
|
+
"description": ( localize(17781, "Key or key sequence (separated by space)"))
|
|
825
835
|
},
|
|
826
836
|
"command": {
|
|
827
837
|
"anyOf": [{
|
|
@@ -833,7 +843,7 @@ class KeybindingsJsonSchema {
|
|
|
833
843
|
"type": "array"
|
|
834
844
|
},
|
|
835
845
|
"errorMessage": ( localize(
|
|
836
|
-
|
|
846
|
+
17782,
|
|
837
847
|
"Incorrect type. Expected \"{0}\". The field 'command' does not support running multiple commands. Use command 'runCommands' to pass it multiple commands to run.",
|
|
838
848
|
"string"
|
|
839
849
|
))
|
|
@@ -847,10 +857,18 @@ class KeybindingsJsonSchema {
|
|
|
847
857
|
},
|
|
848
858
|
"when": {
|
|
849
859
|
"type": "string",
|
|
850
|
-
"description": ( localize(
|
|
860
|
+
"description": ( localize(17783, "Condition when the key is active."))
|
|
851
861
|
},
|
|
852
862
|
"args": {
|
|
853
|
-
"description": ( localize(
|
|
863
|
+
"description": ( localize(17784, "Arguments to pass to the command to execute."))
|
|
864
|
+
},
|
|
865
|
+
"systemWide": {
|
|
866
|
+
"type": "boolean",
|
|
867
|
+
"default": false,
|
|
868
|
+
"markdownDescription": ( localize(
|
|
869
|
+
17785,
|
|
870
|
+
"When `true`, registers this keybinding as a system-wide (OS global) shortcut that fires even when the application is not focused. Desktop only. Only single key combinations are supported (no chords), and any `when` clause is ignored for the global trigger."
|
|
871
|
+
))
|
|
854
872
|
}
|
|
855
873
|
},
|
|
856
874
|
"$ref": "#/definitions/commandsSchemas"
|
|
@@ -480,12 +480,12 @@ const keyboardConfiguration = {
|
|
|
480
480
|
"id": "keyboard",
|
|
481
481
|
"order": 15,
|
|
482
482
|
"type": "object",
|
|
483
|
-
"title": ( localize(
|
|
483
|
+
"title": ( localize(17786, "Keyboard")),
|
|
484
484
|
"properties": {
|
|
485
485
|
"keyboard.layout": {
|
|
486
486
|
"type": "string",
|
|
487
487
|
"default": "autodetect",
|
|
488
|
-
"description": ( localize(
|
|
488
|
+
"description": ( localize(17787, "Control the keyboard layout used in web."))
|
|
489
489
|
}
|
|
490
490
|
}
|
|
491
491
|
};
|
|
@@ -6,6 +6,7 @@ export interface IUserKeybindingItem {
|
|
|
6
6
|
command: string | null;
|
|
7
7
|
commandArgs?: unknown;
|
|
8
8
|
when: ContextKeyExpression | undefined;
|
|
9
|
+
systemWide: boolean;
|
|
9
10
|
_sourceKey: string | undefined; /** captures `key` field from `keybindings.json`; `this.keybinding !== null` implies `_sourceKey !== null` */
|
|
10
11
|
}
|
|
11
12
|
export declare class KeybindingIO {
|
|
@@ -27,6 +27,11 @@ class KeybindingIO {
|
|
|
27
27
|
` "args": ${JSON.stringify(item.commandArgs)}`
|
|
28
28
|
);
|
|
29
29
|
}
|
|
30
|
+
if (item.systemWide) {
|
|
31
|
+
out.write(",");
|
|
32
|
+
out.writeLine();
|
|
33
|
+
out.write(` "systemWide": true`);
|
|
34
|
+
}
|
|
30
35
|
out.write(" }");
|
|
31
36
|
}
|
|
32
37
|
static readUserKeybindingItem(input) {
|
|
@@ -34,11 +39,13 @@ class KeybindingIO {
|
|
|
34
39
|
const when = "when" in input && typeof input.when === "string" ? ContextKeyExpr.deserialize(input.when) : undefined;
|
|
35
40
|
const command = "command" in input && typeof input.command === "string" ? input.command : null;
|
|
36
41
|
const commandArgs = "args" in input && typeof input.args !== "undefined" ? input.args : undefined;
|
|
42
|
+
const systemWide = "systemWide" in input && typeof input.systemWide === "boolean" ? input.systemWide : false;
|
|
37
43
|
return {
|
|
38
44
|
keybinding,
|
|
39
45
|
command,
|
|
40
46
|
commandArgs,
|
|
41
47
|
when,
|
|
48
|
+
systemWide,
|
|
42
49
|
_sourceKey: "key" in input && typeof input.key === "string" ? input.key : undefined
|
|
43
50
|
};
|
|
44
51
|
}
|