diff --git a/crates/command_palette/src/command_palette.rs b/crates/command_palette/src/command_palette.rs index ddefe4d830..0786d9b764 100644 --- a/crates/command_palette/src/command_palette.rs +++ b/crates/command_palette/src/command_palette.rs @@ -135,15 +135,28 @@ impl PickerDelegate for CommandPalette { }) .collect::>(); cx.spawn(move |this, mut cx| async move { - let matches = fuzzy::match_strings( - &candidates, - &query, - true, - 10000, - &Default::default(), - cx.background(), - ) - .await; + let matches = if query.is_empty() { + candidates + .into_iter() + .enumerate() + .map(|(index, candidate)| StringMatch { + candidate_id: index, + string: candidate.string, + positions: Vec::new(), + score: 0.0, + }) + .collect() + } else { + fuzzy::match_strings( + &candidates, + &query, + true, + 10000, + &Default::default(), + cx.background(), + ) + .await + }; this.update(&mut cx, |this, _| { this.matches = matches; if this.matches.is_empty() { @@ -186,7 +199,11 @@ impl PickerDelegate for CommandPalette { let keystroke_spacing = theme.command_palette.keystroke_spacing; Flex::row() - .with_child(Label::new(mat.string.clone(), style.label.clone()).boxed()) + .with_child( + Label::new(mat.string.clone(), style.label.clone()) + .with_highlights(mat.positions.clone()) + .boxed(), + ) .with_children(command.keystrokes.iter().map(|keystroke| { Flex::row() .with_children(