Skip to content

Commit

Permalink
improved shown keybindings in context menu (#13830)
Browse files Browse the repository at this point in the history
* improved shown keybindings in context menu

Signed-off-by: Jonah Iden <[email protected]>

* small performance improvement

Signed-off-by: Jonah Iden <[email protected]>

---------

Signed-off-by: Jonah Iden <[email protected]>
  • Loading branch information
jonah-iden authored Jun 20, 2024
1 parent 6dfbe6f commit a5f03f8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/core/src/browser/menu/browser-menu-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -468,9 +468,11 @@ export class MenuCommandRegistry extends PhosphorCommandRegistry {
});

const bindings = keybindingRegistry.getKeybindingsForCommand(id);
// Only consider the first keybinding.
// Only consider the first active keybinding.
if (bindings.length) {
const binding = bindings[0];
const binding = bindings.length > 1 ?
bindings.find(b => !b.when || this.services.contextKeyService.match(b.when)) ?? bindings[0] :
bindings[0];
const keys = keybindingRegistry.acceleratorFor(binding, ' ', true);
this.addKeyBinding({
command: id,
Expand Down

0 comments on commit a5f03f8

Please sign in to comment.