48
return result.join(' ');
49
}
51
>
52
>
/**
53
>
* A label provider that prints modifiers in a suitable format for displaying in the UI.
54
>
*/
55
>
export const UILabelProvider = new ModifierLabelProvider(
56
>
{
57
>
ctrlKey: '\u2303',
58
>
shiftKey: '⇧',
59
>
altKey: '⌥',
60
>
metaKey: '⌘',
61
>
separator: '',
62
>
},
63
>
{
64
>
ctrlKey: nls.localize({ key: 'ctrlKey', comment: ['This is the short form for the Control key on the keyboard'] }, "Ctrl"),
65
>
shiftKey: nls.localize({ key: 'shiftKey', comment: ['This is the short form for the Shift key on the keyboard'] }, "Shift"),
66
>
altKey: nls.localize({ key: 'altKey', comment: ['This is the short form for the Alt key on the keyboard'] }, "Alt"),
67
>
metaKey: nls.localize({ key: 'windowsKey', comment: ['This is the short form for the Windows key on the keyboard'] }, "Windows"),
68
>
separator: '+',
69
>
},
70
>
{
71
>
ctrlKey: nls.localize({ key: 'ctrlKey', comment: ['This is the short form for the Control key on the keyboard'] }, "Ctrl"),
72
>
shiftKey: nls.localize({ key: 'shiftKey', comment: ['This is the short form for the Shift key on the keyboard'] }, "Shift"),
73
>
altKey: nls.localize({ key: 'altKey', comment: ['This is the short form for the Alt key on the keyboard'] }, "Alt"),
74
>
metaKey: nls.localize({ key: 'superKey', comment: ['This is the short form for the Super key on the keyboard'] }, "Super"),
75
>
separator: '+',
76
>
}
77
>
);
78
>
79
>
/**
80
>
* A label provider that prints modifiers in a suitable format for ARIA.
81
>
*/
82
>
export const AriaLabelProvider = new ModifierLabelProvider(
83
>
{
84
>
ctrlKey: nls.localize({ key: 'ctrlKey.long', comment: ['This is the long form for the Control key on the keyboard'] }, "Control"),
85
>
shiftKey: nls.localize({ key: 'shiftKey.long', comment: ['This is the long form for the Shift key on the keyboard'] }, "Shift"),
86
>
altKey: nls.localize({ key: 'optKey.long', comment: ['This is the long form for the Alt/Option key on the keyboard'] }, "Option"),
87
>
metaKey: nls.localize({ key: 'cmdKey.long', comment: ['This is the long form for the Command key on the keyboard'] }, "Command"),
88
>
separator: '+',
89
>
},
90
>
{
91
>
ctrlKey: nls.localize({ key: 'ctrlKey.long', comment: ['This is the long form for the Control key on the keyboard'] }, "Control"),
92
>
shiftKey: nls.localize({ key: 'shiftKey.long', comment: ['This is the long form for the Shift key on the keyboard'] }, "Shift"),
93
>
altKey: nls.localize({ key: 'altKey.long', comment: ['This is the long form for the Alt key on the keyboard'] }, "Alt"),
94
>
metaKey: nls.localize({ key: 'windowsKey.long', comment: ['This is the long form for the Windows key on the keyboard'] }, "Windows"),
95
>
separator: '+',
96
>
},
97
>
{
98
>
ctrlKey: nls.localize({ key: 'ctrlKey.long', comment: ['This is the long form for the Control key on the keyboard'] }, "Control"),
99
>
shiftKey: nls.localize({ key: 'shiftKey.long', comment: ['This is the long form for the Shift key on the keyboard'] }, "Shift"),
100
>
altKey: nls.localize({ key: 'altKey.long', comment: ['This is the long form for the Alt key on the keyboard'] }, "Alt"),
101
>
metaKey: nls.localize({ key: 'superKey.long', comment: ['This is the long form for the Super key on the keyboard'] }, "Super"),
102
>
separator: '+',
103
>
}
104
>
);
105
>
106
>
/**
107
>
* A label provider that prints modifiers in a suitable format for Electron Accelerators.
108
>
* See https://github.com/electron/electron/blob/master/docs/api/accelerator.md
109
>
*/
110
>
export const ElectronAcceleratorLabelProvider = new ModifierLabelProvider(
111
>
{
112
>
ctrlKey: 'Ctrl',
113
>
shiftKey: 'Shift',
114
>
altKey: 'Alt',
115
>
metaKey: 'Cmd',
116
>
separator: '+',
117
>
},
118
>
{
119
>
ctrlKey: 'Ctrl',
120
>
shiftKey: 'Shift',
121
>
altKey: 'Alt',
122
>
metaKey: 'Super',
123
>
separator: '+',
124
>
}
125
>
);
126
>
127
>
/**
128
>
* A label provider that prints modifiers in a suitable format for user settings.
129
>
*/
130
>
export const UserSettingsLabelProvider = new ModifierLabelProvider(
131
>
{
132
>
ctrlKey: 'ctrl',
133
>
shiftKey: 'shift',
134
>
altKey: 'alt',
135
>
metaKey: 'cmd',
136
>
separator: '+',
137
>
},
138
>
{
139
>
ctrlKey: 'ctrl',
140
>
shiftKey: 'shift',
141
>
altKey: 'alt',
142
>
metaKey: 'win',
143
>
separator: '+',
144
>
},
145
>
{
146
>
ctrlKey: 'ctrl',
147
>
shiftKey: 'shift',
148
>
altKey: 'alt',
149
>
metaKey: 'meta',
150
>
separator: '+',
151
>
}
152
>
);
153
>
154
function _simpleAsString(modifiers: Modifiers, key: string, labels: ModifierLabels): string {
155
if (key === null) {