Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show Keyboard Shortcuts in Toolbar Item Tooltips #12656

Closed
tsmaeder opened this issue Jun 28, 2023 · 1 comment · Fixed by #12660
Closed

Show Keyboard Shortcuts in Toolbar Item Tooltips #12656

tsmaeder opened this issue Jun 28, 2023 · 1 comment · Fixed by #12660
Labels
keybindings issues related to keybindings toolbar issues related to the toolbar

Comments

@tsmaeder
Copy link
Contributor

Feature Description:

In VS Code, toolbar items show the active keyboard shortcut for the underlying command in their tooltip. I request that we do the same in Theia where possible. The original requirement for this comes from folks contributing tree views, so this is the primary use case to be covered. In that case, the shortcuts are shown both in the view toolbar as well as the toolbars for individual tree items.

@msujew msujew added the toolbar issues related to the toolbar label Jun 28, 2023
@tsmaeder
Copy link
Contributor Author

This seems quite simple at the outset, but there are a couple of issues:

  1. Multiple Bindings
    The same command can be bound to multiple key sequences. In this case, I think we can just show the first one: it's just a "tip" after all
  2. Conditional activation of keybindings
    Keybindings can be active depending on their "context" and the evaluation of their "when"-field context key expression. When we have two bindings of the same key sequence to different commands, both, either or none may be active depending on these conditions. The same is true when we bind the same command to two different key sequences. We cannot tell which one is active once and for all. For the when field, we can observe the context keys to detect possible changes to keybinding activation, but the KeybindingContext interface used for the context field of a binding does not offer observable state. Since the tooltip is not computed when rendering the toolbar item (not on the fly), we have no way to update to the correct shortcut when the activation state of a binding changes do to changes in the context. Given that the context field is deprecated, I would just accept that limitation instead of introduction change notification on the KeybindingContext interface.
  3. Conflicting bindings
    The conditional activation of bindings means we cannot guard against having multiple bindings active for the same key sequence. In this case, which command will be executed for the key sequence? The answer depends on the details of the algorithm used for looking up keybindings.

@msujew msujew added the keybindings issues related to keybindings label Jun 28, 2023
tsmaeder added a commit to tsmaeder/theia that referenced this issue Jun 29, 2023
…12656

Contributed on behalf of STMicroelectronics

Signed-off-by: Thomas Mäder <[email protected]>
tsmaeder added a commit to tsmaeder/theia that referenced this issue Jun 29, 2023
…12656

Contributed on behalf of STMicroelectronics

Signed-off-by: Thomas Mäder <[email protected]>
tsmaeder added a commit to tsmaeder/theia that referenced this issue Jul 6, 2023
…12656

Contributed on behalf of STMicroelectronics

Signed-off-by: Thomas Mäder <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
keybindings issues related to keybindings toolbar issues related to the toolbar
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants