Skip to content

Commit 37594f7

Browse files
ChrHornarchseer
authored and
Shekhinah Memmel
committed
Remove prefix filtering from autocomplete menu (helix-editor#4578)
PR helix-editor#4134 switched the autocomplete menu from alphabetical to fuzzy sorting. This commit removes the still existing filtering by prefix and should enable full fuzzy sorting of the autocomplete menu. closes helix-editor#3084, helix-editor#1807 Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
1 parent f4c2719 commit 37594f7

File tree

1 file changed

+1
-11
lines changed

1 file changed

+1
-11
lines changed

helix-term/src/commands.rs

+1-11
Original file line numberDiff line numberDiff line change
@@ -3990,7 +3990,6 @@ pub fn completion(cx: &mut Context) {
39903990
iter.reverse();
39913991
let offset = iter.take_while(|ch| chars::char_is_word(*ch)).count();
39923992
let start_offset = cursor.saturating_sub(offset);
3993-
let prefix = text.slice(start_offset..cursor).to_string();
39943993

39953994
cx.callback(
39963995
future,
@@ -4000,7 +3999,7 @@ pub fn completion(cx: &mut Context) {
40003999
return;
40014000
}
40024001

4003-
let mut items = match response {
4002+
let items = match response {
40044003
Some(lsp::CompletionResponse::Array(items)) => items,
40054004
// TODO: do something with is_incomplete
40064005
Some(lsp::CompletionResponse::List(lsp::CompletionList {
@@ -4010,15 +4009,6 @@ pub fn completion(cx: &mut Context) {
40104009
None => Vec::new(),
40114010
};
40124011

4013-
if !prefix.is_empty() {
4014-
items.retain(|item| {
4015-
item.filter_text
4016-
.as_ref()
4017-
.unwrap_or(&item.label)
4018-
.starts_with(&prefix)
4019-
});
4020-
}
4021-
40224012
if items.is_empty() {
40234013
// editor.set_error("No completion available");
40244014
return;

0 commit comments

Comments
 (0)