Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

assistant2: Fix filtering issue when using @mention completion provider (#27541)

Bennet Bo Fenner2b5095ac91ea
diff --git a/crates/assistant2/src/context_picker/completion_provider.rs b/crates/assistant2/src/context_picker/completion_provider.rs
index 8570c474496..20d16970a74 100644
--- a/crates/assistant2/src/context_picker/completion_provider.rs
+++ b/crates/assistant2/src/context_picker/completion_provider.rs
@@ -544,6 +544,10 @@ impl CompletionProvider for ContextPickerCompletionProvider {
fn sort_completions(&self) -> bool {
false
}
+
+ fn filter_completions(&self) -> bool {
+ false
+ }
}
fn confirm_completion_callback(
diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs
index 0c26d012f2e..fe1d38a5ae9 100644
--- a/crates/editor/src/editor.rs
+++ b/crates/editor/src/editor.rs
@@ -4326,6 +4326,10 @@ impl Editor {
.as_ref()
.map_or(true, |provider| provider.sort_completions());
+ let filter_completions = provider
+ .as_ref()
+ .map_or(true, |provider| provider.filter_completions());
+
let id = post_inc(&mut self.next_completion_id);
let task = cx.spawn_in(window, async move |editor, cx| {
async move {
@@ -4374,8 +4378,15 @@ impl Editor {
completions.into(),
);
- menu.filter(query.as_deref(), cx.background_executor().clone())
- .await;
+ menu.filter(
+ if filter_completions {
+ query.as_deref()
+ } else {
+ None
+ },
+ cx.background_executor().clone(),
+ )
+ .await;
menu.visible().then_some(menu)
};
@@ -18041,6 +18052,10 @@ pub trait CompletionProvider {
fn sort_completions(&self) -> bool {
true
}
+
+ fn filter_completions(&self) -> bool {
+ true
+ }
}
pub trait CodeActionProvider {