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

Command palette command discovery #4154

Merged
merged 23 commits into from
Feb 15, 2024

Conversation

davep
Copy link
Contributor

@davep davep commented Feb 13, 2024

PR to add a discovery API to the command palette, which allows command providers to offer up commands that should appear in the command palette's dropdown as soon as it's opened.

Implements #4111.

The request in #4111 was to show everything, but this could be problematic depending on the nature of the provider; so this approach adds a discover method, which can be omitted, and the discoverable commands will be taken from that; this gives providers the option to either offer up all their commands, or just a subset that make sense.

This PR also implements textual._system_commands.SystemCommands.discover.

@davep davep added enhancement New feature or request Task labels Feb 13, 2024
@davep davep self-assigned this Feb 13, 2024
@davep davep linked an issue Feb 13, 2024 that may be closed by this pull request
@davep davep changed the title WiP: Command palette command discovery Command palette command discovery Feb 14, 2024
@davep davep marked this pull request as ready for review February 14, 2024 10:29
Copy link
Contributor

@rodrigogiraoserrao rodrigogiraoserrao left a comment

Choose a reason for hiding this comment

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

I left a couple of (subjective) docstring suggestions and a couple of other minor suggestions. None of them warranted I blocked the PR 🤷

Good job 🐍 🚀

docs/guide/command_palette.md Outdated Show resolved Hide resolved
src/textual/command.py Show resolved Hide resolved
src/textual/command.py Show resolved Hide resolved
src/textual/command.py Outdated Show resolved Hide resolved
src/textual/command.py Show resolved Hide resolved
src/textual/command.py Show resolved Hide resolved
src/textual/command.py Show resolved Hide resolved
src/textual/command.py Show resolved Hide resolved
tests/command_palette/test_discover.py Show resolved Hide resolved
@davep davep merged commit e75779f into Textualize:main Feb 15, 2024
20 checks passed
@davep davep deleted the command-palette-default-hits branch February 15, 2024 11:49
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 this pull request may close these issues.

Show all commands in command palette
2 participants