Skip to content

Commit f1b80b4

Browse files
feat: prioritize exact and smaller matches
1 parent d752d90 commit f1b80b4

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

helix-term/src/ui/completion.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,13 @@ impl Completion {
369369
let min_score = (7 + pattern.needle_text().len() as u32 * 14) / 3;
370370
matches.sort_unstable_by_key(|&(i, score)| {
371371
let option = &options[i as usize];
372+
let filter_text = option.filter_text();
373+
let is_exact_match = Utf32Str::new(filter_text, &mut buf) == pattern.needle_text();
374+
let match_length = filter_text.len() as u32;
375+
372376
(
377+
!is_exact_match,
378+
match_length,
373379
score <= min_score,
374380
Reverse(option.preselect()),
375381
option.provider_priority(),

0 commit comments

Comments
 (0)