diff --git a/crates/command_palette2/src/command_palette.rs b/crates/command_palette2/src/command_palette.rs index e403a50cf9..1386186ca4 100644 --- a/crates/command_palette2/src/command_palette.rs +++ b/crates/command_palette2/src/command_palette.rs @@ -130,16 +130,7 @@ impl CommandPaletteDelegate { ) -> Self { Self { command_palette, - matches: commands - .iter() - .enumerate() - .map(|(i, command)| StringMatch { - candidate_id: i, - string: command.name.clone(), - positions: Vec::new(), - score: 0.0, - }) - .collect(), + matches: vec![], commands, selected_ix: 0, previous_focus_handle, diff --git a/crates/picker2/src/picker2.rs b/crates/picker2/src/picker2.rs index e1979f1b13..836a612491 100644 --- a/crates/picker2/src/picker2.rs +++ b/crates/picker2/src/picker2.rs @@ -10,7 +10,7 @@ pub struct Picker { pub delegate: D, scroll_handle: UniformListScrollHandle, editor: View, - pending_update_matches: Option>>, + pending_update_matches: Option>, } pub trait PickerDelegate: Sized + 'static { @@ -42,12 +42,14 @@ impl Picker { editor }); cx.subscribe(&editor, Self::on_input_editor_event).detach(); - Self { + let mut this = Self { delegate, scroll_handle: UniformListScrollHandle::new(), pending_update_matches: None, editor, - } + }; + this.update_matches("".to_string(), cx); + this } pub fn focus(&self, cx: &mut WindowContext) { @@ -126,7 +128,7 @@ impl Picker { this.update(&mut cx, |this, cx| { this.matches_updated(cx); }) - .ok() + .ok(); })); }