Polish prompt library UX (#12647)
This could still use some improvement UI-wise but the user experience
should be a lot better.
- [x] Show in "Window" application menu
- [x] Load prompt as it's selected in the picker
- [x] Refocus picker on `esc`
- [x] When creating a new prompt, if a new prompt already exists and is
unedited, activate it instead
- [x] Add `/default` command
- [x] Evaluate /commands on prompt insertion
- [x] Autocomplete /commands (but don't evaluate) during prompt editing
- [x] Show token count using the settings model, right-aligned in the
editor
- [x] Picker
- [x] Sorted alpha
- [x] 2 sublists
- Default
- Empty state: Star a prompt to add it to your default prompt
- Otherwise show prompts with star on hover
- All
- Move prompts with star on hover
Release Notes:
- N/A
This commit is contained in:
@@ -236,7 +236,12 @@ impl<D: PickerDelegate> Picker<D> {
|
||||
/// If `scroll_to_index` is true, the new selected index will be scrolled into view.
|
||||
///
|
||||
/// If some effect is bound to `selected_index_changed`, it will be executed.
|
||||
fn set_selected_index(&mut self, ix: usize, scroll_to_index: bool, cx: &mut ViewContext<Self>) {
|
||||
pub fn set_selected_index(
|
||||
&mut self,
|
||||
ix: usize,
|
||||
scroll_to_index: bool,
|
||||
cx: &mut ViewContext<Self>,
|
||||
) {
|
||||
let previous_index = self.delegate.selected_index();
|
||||
self.delegate.set_selected_index(ix, cx);
|
||||
let current_index = self.delegate.selected_index();
|
||||
|
||||
Reference in New Issue
Block a user