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

Key panel widget #4876

Merged
merged 29 commits into from
Aug 20, 2024
Merged

Key panel widget #4876

merged 29 commits into from
Aug 20, 2024

Conversation

willmcgugan
Copy link
Collaborator

@willmcgugan willmcgugan commented Aug 12, 2024

Adds a KeyPanel which can be summoned via the command palette.

@willmcgugan willmcgugan marked this pull request as draft August 12, 2024 15:43
@willmcgugan willmcgugan marked this pull request as ready for review August 20, 2024 09:50
@willmcgugan willmcgugan changed the title WIP Key panel widget Key panel widget Aug 20, 2024
# ...cause the first completion to be highlighted.
self._action_cursor_down()
# If there is one option, assume the user wants to select it
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this subject to the same issue as what we discussed earlier regarding having the first option always highlighted by default? If they can come in asynchronously, then when the user presses enter there may only be 1, but this doesn't mean there will always be one.

I think in VSCode and the browser URL bar, it also does things asynchronously, but it just selects the one that was at the top when the user presses enter.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That does introduce a 100ms window where something could change. I'll see if I can remove that.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've removed the timer for now. In a future update, I'll implement the logic to highlight the first item.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

@darrenburns darrenburns left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good and works well. I made a few suggestions which I don't think need to be part of this PR, but would be nice to create tasks for and tackle relatively soon IMO (otherwise they'll end up forgotten).

@darrenburns
Copy link
Member

darrenburns commented Aug 20, 2024

Also want to suggest that we have some way of showing which "level" of the DOM keybindings belong to. This sidebar looks a bit confusing in Posting for example, because I can't tell which widget a binding belongs to.

e.g. I have a binding called Expand section. If I have the Tree focused, it's not clear if that means "expand the current node of the tree", or "expand the tree section of the overall app". I think if they were somehow grouped with the widget name (if available) or something it'd be easier to read in large apps with many bindings (where the key panel is itself most beneficial).

Example from the lazygit UI which has two levels: local and global...

image

@darrenburns
Copy link
Member

Another thing that I just noticed in the lazygit popup is that you can click the bindings and it runs the action, similar to our Footer widget.

@willmcgugan
Copy link
Collaborator Author

#4904

@willmcgugan willmcgugan merged commit 8a1c603 into main Aug 20, 2024
20 checks passed
@willmcgugan willmcgugan deleted the key-panel branch August 20, 2024 12:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants