on master help sign in
Remove prefix filtering from autocomplete menu (#4578)
322e957ChrHorn
helix-term/src/commands.rs+1−11
@@ -3950,7 +3950,6 @@ pub fn completion(cx: &mut Context) {
3950 iter.reverse();
3950 iter.reverse();
3951 let offset = iter.take_while(|ch| chars::char_is_word(*ch)).count();
3951 let offset = iter.take_while(|ch| chars::char_is_word(*ch)).count();
3952 let start_offset = cursor.saturating_sub(offset);
3952 let start_offset = cursor.saturating_sub(offset);
3953− let prefix = text.slice(start_offset..cursor).to_string();
3954
3953
3955 cx.callback(
3954 cx.callback(
3956 future,
3955 future,
@@ -3960,7 +3959,7 @@ pub fn completion(cx: &mut Context) {
3960 return;
3959 return;
3961 }
3960 }
3962
3961
3963− let mut items = match response {
3962+ let items = match response {
3964 Some(lsp::CompletionResponse::Array(items)) => items,
3963 Some(lsp::CompletionResponse::Array(items)) => items,
3965 // TODO: do something with is_incomplete
3964 // TODO: do something with is_incomplete
3966 Some(lsp::CompletionResponse::List(lsp::CompletionList {
3965 Some(lsp::CompletionResponse::List(lsp::CompletionList {
@@ -3970,15 +3969,6 @@ pub fn completion(cx: &mut Context) {
3970 None => Vec::new(),
3969 None => Vec::new(),
3971 };
3970 };
3972
3971
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−
3982 if items.is_empty() {
3972 if items.is_empty() {
3983 // editor.set_error("No completion available");
3973 // editor.set_error("No completion available");
3984 return;
3974 return;