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 all commands in command palette #4111

Closed
chbndrhnns opened this issue Feb 2, 2024 · 10 comments · Fixed by #4154
Closed

Show all commands in command palette #4111

chbndrhnns opened this issue Feb 2, 2024 · 10 comments · Fixed by #4154
Assignees
Labels
enhancement New feature or request Task

Comments

@chbndrhnns
Copy link

When I'd like to explore an app, I would want to see all available commands available in the command palette just by pulling it up, just like VS Code does it.

@Textualize Textualize deleted a comment from github-actions bot Feb 2, 2024
@willmcgugan
Copy link
Collaborator

I think this is very good idea.

@darrenburns
Copy link
Member

Just to make sure I'm understanding correctly - does this mean when the search box is empty, we show everything?

@davep
Copy link
Contributor

davep commented Feb 12, 2024

Just to add context (not really to answer that question), this stems from this conversation on Discord, as far as I can tell.

In terms of my own ideas on it: I'm not a huge fan of "show everything by default", but I can see the value in "cursor down when empty shows everything".

@willmcgugan
Copy link
Collaborator

We might want to have some mechanism to cherry pick the commands we show, just so it doesn't get too large. But I do think they should show when the input is empty.

@davep davep self-assigned this Feb 12, 2024
@davep davep added enhancement New feature or request Task labels Feb 12, 2024
@davep
Copy link
Contributor

davep commented Feb 12, 2024

Picking this up... defining characteristics of the enhancement request so far:

  • All applicable hits start to trickle into the display the moment the command palette opens.
  • Some method of deciding what is an applicable hit needs to be decided and added.

My initial feeling is that the bulk of the work here is around deciding and implementing the latter; my gut reaction is that one or more of the following could be approaches (just thinking out loud before diving back into the code):

  • It could be left totally up to the providers; if given a empty string to search for, they could decide what to yield up.
  • It could be left totally up to the providers; but instead there's a method that's parallel to Provider.search that is more like Provider.default or something, and this yields up all of the commands the provider wants to provide by default.
  • It could be left totally up to the providers; but it's a on/off switch at the provider level that says if it wants to take part in providing default hits.

One question stands out right away:

  • What ordering to use when there's no match score to go off.

Seems that alphabetical order would make sense.

@darrenburns
Copy link
Member

What ordering to use when there's no match score to go off.

Could we use the order that would be used when the search value is ""?

@davep
Copy link
Contributor

davep commented Feb 12, 2024

That would mean that every Hit has a score of either 0 or 1 (not sure which would make more sense I guess), so the order is probably going to be the speed with which they come in. Not sure that quite makes sense (or rather, it does, but might not be useful)?

@willmcgugan
Copy link
Collaborator

Do we really want to search? I was thinking each provider would offer up some text that tells the user what it accepts.

Like ("Help", "Show the help screen.") or ("open FILENAME", "Open a file.")

@davep
Copy link
Contributor

davep commented Feb 12, 2024

Works for me! I think that's pretty much what I had in mind with the Provider.default parallel method (for want of a better name).

@davep davep linked a pull request Feb 13, 2024 that will close this issue
Copy link

Don't forget to star the repository!

Follow @textualizeio for Textual updates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Task
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants