Skip to content

Commit 78fea18

Browse files
ChrHornarchseer
authored andcommitted
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 <[email protected]>
1 parent a6c98ac commit 78fea18

File tree

1 file changed

+1
-11
lines changed

1 file changed

+1
-11
lines changed

helix-term/src/commands.rs

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3950,7 +3950,6 @@ pub fn completion(cx: &mut Context) {
39503950
iter.reverse();
39513951
let offset = iter.take_while(|ch| chars::char_is_word(*ch)).count();
39523952
let start_offset = cursor.saturating_sub(offset);
3953-
let prefix = text.slice(start_offset..cursor).to_string();
39543953

39553954
cx.callback(
39563955
future,
@@ -3960,7 +3959,7 @@ pub fn completion(cx: &mut Context) {
39603959
return;
39613960
}
39623961

3963-
let mut items = match response {
3962+
let items = match response {
39643963
Some(lsp::CompletionResponse::Array(items)) => items,
39653964
// TODO: do something with is_incomplete
39663965
Some(lsp::CompletionResponse::List(lsp::CompletionList {
@@ -3970,15 +3969,6 @@ pub fn completion(cx: &mut Context) {
39703969
None => Vec::new(),
39713970
};
39723971

3973-
if !prefix.is_empty() {
3974-
items.retain(|item| {
3975-
item.filter_text
3976-
.as_ref()
3977-
.unwrap_or(&item.label)
3978-
.starts_with(&prefix)
3979-
});
3980-
}
3981-
39823972
if items.is_empty() {
39833973
// editor.set_error("No completion available");
39843974
return;

0 commit comments

Comments
 (0)