From a5e1b019b96aa5d2ce4351c316a455747fc5696e Mon Sep 17 00:00:00 2001 From: Christoph Horn Date: Thu, 3 Nov 2022 10:31:26 +0100 Subject: [PATCH] Remove prefix filtering from autocomplete menu This commit removes the still existing filtering by prefix and should enable full fuzzy sorting of the autocomplete menu. closes #3084, #1807 --- helix-term/src/commands.rs | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index ee9bad980487a..cedb78ad956d3 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -3912,7 +3912,6 @@ pub fn completion(cx: &mut Context) { iter.reverse(); let offset = iter.take_while(|ch| chars::char_is_word(*ch)).count(); let start_offset = cursor.saturating_sub(offset); - let prefix = text.slice(start_offset..cursor).to_string(); cx.callback( future, @@ -3922,7 +3921,7 @@ pub fn completion(cx: &mut Context) { return; } - let mut items = match response { + let items = match response { Some(lsp::CompletionResponse::Array(items)) => items, // TODO: do something with is_incomplete Some(lsp::CompletionResponse::List(lsp::CompletionList { @@ -3932,18 +3931,6 @@ pub fn completion(cx: &mut Context) { None => Vec::new(), }; - if !prefix.is_empty() { - items = items - .into_iter() - .filter(|item| { - item.filter_text - .as_ref() - .unwrap_or(&item.label) - .starts_with(&prefix) - }) - .collect(); - } - if items.is_empty() { // editor.set_error("No completion available"); return;