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

Previously `src` would not show up because it was filtered out:

<img width="466" alt="image"
src="https://github.com/user-attachments/assets/f3802660-ad73-44be-967d-c332466d9aba"
/>

Release Notes:

- N/A
This commit is contained in:
Bennet Bo Fenner 2025-03-26 22:18:25 +01:00 committed by GitHub
parent 9e02fee98d
commit 2b5095ac91
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 21 additions and 2 deletions

View file

@ -544,6 +544,10 @@ impl CompletionProvider for ContextPickerCompletionProvider {
fn sort_completions(&self) -> bool {
false
}
fn filter_completions(&self) -> bool {
false
}
}
fn confirm_completion_callback(

View file

@ -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 {