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

Predefined search/filter text in the Select prompt #139

Open
Tiseno opened this issue May 10, 2023 · 2 comments
Open

Predefined search/filter text in the Select prompt #139

Tiseno opened this issue May 10, 2023 · 2 comments

Comments

@Tiseno
Copy link

Tiseno commented May 10, 2023

Is your feature request related to a problem? Please describe.
When presenting a Select prompt, I would like the search/filter text to be pre-populated.

Describe the solution you'd like
A function like .with_predefined_text (like in the Editor prompt) or .with_initial_value (like in the Text prompt).
Maybe .with_predefined_search? Or maybe better to make it general, .with_predefined_input.

Describe alternatives you've considered
Alternative for my use case would be a Text prompt instead, and use the text entered to do a lookup in my data.

Edit: Took a stab at an implementation for my own usage #140

@mikaelmello
Copy link
Owner

First, sorry for not replying sooner.

Can you tell me a bit more about your scenario?

I see some use-cases for it:

  • On selects, display an initial list of values first
  • On customType/confirm, a suggestion or default value

The thing is that in these cases an initial value feels to me like the wrong solution to the problem it's trying to solve. It feels kind of clunky from the user-perspective if they have to delete this pre-filled value that's already there, like they're starting from a bad place already.

Adding it as an optional feature should be possible enough (as you already did on the PR), but before putting one extra knob I'm really interested in understanding if this knob is achieving the right thing

@Tiseno
Copy link
Author

Tiseno commented Jun 11, 2023

Sure, my scenario was a kind of http request REPL. Basically: first choose from a list of profiles (development, production, etc) then from a list of services (defined by openapi definitions) and then choose from a list of requests. Without prefilled input; to execute the same request multiple times one needed to search again to select it, and going back up, it was more natural for the previously selected thing to be selected already.

I radically changed the structure of the program so I do not really need this functionality for the execution of the request repeatedly anymore, but I think it is a nice change to make tha apis consistent and available for all different prompts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants