diff options
author | Pascal Kuthe | 2022-10-06 23:44:53 +0000 |
---|---|---|
committer | Blaž Hrastnik | 2022-10-21 01:03:00 +0000 |
commit | 8673c1ec0cb4074a1082d4681b655110d5b7facb (patch) | |
tree | b4f3f442d836466a6f609b994a7b4b1bfb81ac86 /helix-term/src/ui/menu.rs | |
parent | ce399471f047c241c63caba11ce154776df5024c (diff) |
sort codeaction by their kind instead of alphabetically
Diffstat (limited to 'helix-term/src/ui/menu.rs')
-rw-r--r-- | helix-term/src/ui/menu.rs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/helix-term/src/ui/menu.rs b/helix-term/src/ui/menu.rs index f77f5e80..b60e6454 100644 --- a/helix-term/src/ui/menu.rs +++ b/helix-term/src/ui/menu.rs @@ -74,6 +74,7 @@ impl<T: Item> Menu<T> { // rendering) pub fn new( options: Vec<T>, + sort: bool, editor_data: <T as Item>::Data, callback_fn: impl Fn(&mut Editor, Option<&T>, MenuEvent) + 'static, ) -> Self { @@ -91,8 +92,12 @@ impl<T: Item> Menu<T> { recalculate: true, }; - // TODO: scoring on empty input should just use a fastpath - menu.score(""); + if sort { + // TODO: scoring on empty input should just use a fastpath + menu.score(""); + } else { + menu.matches = (0..menu.options.len()).map(|i| (i, 0)).collect(); + } menu } |