-
-
Notifications
You must be signed in to change notification settings - Fork 515
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
Allow to add handlers for prompts #230
Comments
@angelobreuer I'm having a difficult time seeing how this would bring any big benefits. |
-- @patriksvensson
Yes, in my project, I have some cases where live, interactive prompts could benefit the user experience. For example, I have a multi-selection prompt, where I allow the user to select bit flags. For instance, I would explain (on the right in the console) what the bit flag is supposed for and what bit mask is currently calculated. Additionally, I also have another use case: I provide a tui to run examples that demonstrate my library's use. These samples are selectable using the selection prompt. Adding handlers would make me able to give a description based on the sample metadata. (Maybe off-topic: Another idea that came up is to provide the user with information about the sample was to have a table where on the left is a selection prompt and on the right the description of the sample. I suddenly did not find a solution for using spectre. As a) the interactive selection handling is missing and b) tables with a prompt is currently, as far I know, not directly supported). Generally, I think prompts are a handy "thing," but they do not provide much flexibility as they take something in and out without allowing any attachable interrupts. This would provide developers way more flexibility when working with prompts. Another use case would be to allow developers to preload things as the user scrolls down (which would expand the issue itself because I think this may require some structural changes). In my "sample runner", I have the user select an environment where to try out that sample, the list of environments may be small, but also large, the data amount is unknown, and the API allows only to request the data in chunks. Hence, the prompt is very limited in this case, as only fixed data is allowed. Thank you for reading! |
This is actually a rather useful feature to have in multiselect prompts where selecting one item selects others as they might be dependencies. I'm currently using this to write a development kit console application where selecting dependencies as locked multiselect items that you can't unlock until the parent is also deselected would be nice to have. Since dependencies show up multiple times you can't just group it once but would have to instead group it multiple times. |
Yesterday, I came up with the same idea as @angelobreuer. I have seen similar TUI approaches in Telescope (https://github.com/nvim-telescope/telescope.nvim) and fzf (https://github.com/junegunn/fzf). These tools can show previews for each selection in a right-hand side panel. While digging through the code and documentation, I realized that adding hooks for handlers would probably be fairly easy to do. I think the harder part which would require more design work, is the other side of the hook. How would the handler affect rendering of other components? Currently, there is only the Live Display that allows to update widgets. |
My view on this requirement- I have a dependency of items on each other. Say, if I have A, B and C listed, selecting B, should also select A immediately. I also could not provide my own On the other hand, if I want to make it look like a tree selection in prompt, (not sure if it is supported even), I can't There are lot of design restrictions that should be reviewed. |
Is your feature request related to a problem? Please describe.
Allow users to add hooks to prompts.
Describe the solution you'd like
For example, adding the support of doing the following:
Why is this needed?
I think adding hooks would be helpful to inform the user about what is set.
This would also add the ability to make something like the following:
Describe alternatives you've considered
---Additional context
I would be able to grab this if this is considered a feature.
Please upvote 👍 this issue if you are interested in it.
The text was updated successfully, but these errors were encountered: