@@ -52,15 +52,7 @@ export class USLayoutResolvedKeybinding extends ResolvedKeybinding {
5252 }
5353
5454 public getLabel ( ) : string | null {
55- let partKeys : string [ ] = [ ] ;
56- for ( let part of this . _parts ) {
57- let key = this . _getUILabelForKeybinding ( part ) ;
58- if ( key === null ) {
59- return null ;
60- }
61- partKeys . push ( key ) ;
62- }
63- return UILabelProvider . toLabel ( this . _parts , partKeys , this . _os ) ;
55+ return UILabelProvider . toLabel ( this . _os , this . _parts , ( keybinding ) => this . _getUILabelForKeybinding ( keybinding ) ) ;
6456 }
6557
6658 private _getAriaLabelForKeybinding ( keybinding : SimpleKeybinding | null ) : string | null {
@@ -74,15 +66,7 @@ export class USLayoutResolvedKeybinding extends ResolvedKeybinding {
7466 }
7567
7668 public getAriaLabel ( ) : string | null {
77- let partKeys : string [ ] = [ ] ;
78- for ( let part of this . _parts ) {
79- let key = this . _getAriaLabelForKeybinding ( part ) ;
80- if ( key === null ) {
81- return null ;
82- }
83- partKeys . push ( key ) ;
84- }
85- return AriaLabelProvider . toLabel ( this . _parts , partKeys , this . _os ) ;
69+ return AriaLabelProvider . toLabel ( this . _os , this . _parts , ( keybinding ) => this . _getAriaLabelForKeybinding ( keybinding ) ) ;
8670 }
8771
8872 private _keyCodeToElectronAccelerator ( keyCode : KeyCode ) : string | null {
@@ -121,11 +105,7 @@ export class USLayoutResolvedKeybinding extends ResolvedKeybinding {
121105 return null ;
122106 }
123107
124- let firstPart = this . _getElectronAcceleratorLabelForKeybinding ( this . _parts [ 0 ] ) ;
125- if ( firstPart === null ) {
126- return null ;
127- }
128- return ElectronAcceleratorLabelProvider . toLabel ( this . _parts , [ firstPart ] , this . _os ) ;
108+ return ElectronAcceleratorLabelProvider . toLabel ( this . _os , this . _parts , ( keybinding ) => this . _getElectronAcceleratorLabelForKeybinding ( keybinding ) ) ;
129109 }
130110
131111 private _getUserSettingsLabelForKeybinding ( keybinding : SimpleKeybinding | null ) : string | null {
@@ -139,15 +119,7 @@ export class USLayoutResolvedKeybinding extends ResolvedKeybinding {
139119 }
140120
141121 public getUserSettingsLabel ( ) : string | null {
142- let partKeys : string [ ] = [ ] ;
143- for ( let part of this . _parts ) {
144- let key = this . _getUserSettingsLabelForKeybinding ( part ) ;
145- if ( key === null ) {
146- return null ;
147- }
148- partKeys . push ( key ) ;
149- }
150- let result = UserSettingsLabelProvider . toLabel ( this . _parts , partKeys , this . _os ) ;
122+ const result = UserSettingsLabelProvider . toLabel ( this . _os , this . _parts , ( keybinding ) => this . _getUserSettingsLabelForKeybinding ( keybinding ) ) ;
151123 return ( result ? result . toLowerCase ( ) : result ) ;
152124 }
153125
@@ -156,11 +128,11 @@ export class USLayoutResolvedKeybinding extends ResolvedKeybinding {
156128 }
157129
158130 public isChord ( ) : boolean {
159- return this . _parts . length > 1 ;
131+ return ( this . _parts . length > 1 ) ;
160132 }
161133
162134 public getParts ( ) : ResolvedKeybindingPart [ ] {
163- return this . _parts . map ( this . _toResolvedKeybindingPart , this ) ;
135+ return this . _parts . map ( ( keybinding ) => this . _toResolvedKeybindingPart ( keybinding ) ) ;
164136 }
165137
166138 private _toResolvedKeybindingPart ( keybinding : SimpleKeybinding ) : ResolvedKeybindingPart {
@@ -175,7 +147,7 @@ export class USLayoutResolvedKeybinding extends ResolvedKeybinding {
175147 }
176148
177149 public getDispatchParts ( ) : ( string | null ) [ ] {
178- return this . _parts . map ( ( chord ) => USLayoutResolvedKeybinding . getDispatchStr ( chord ) ) ;
150+ return this . _parts . map ( ( keybinding ) => USLayoutResolvedKeybinding . getDispatchStr ( keybinding ) ) ;
179151 }
180152
181153 public static getDispatchStr ( keybinding : SimpleKeybinding ) : string | null {
0 commit comments