Keep and filter word completions on input, if the menu is open (#26979)

Follow-up of https://github.com/zed-industries/zed/pull/26410

Release Notes:

- N/A
This commit is contained in:
Kirill Bulatov 2025-03-18 13:19:32 +02:00 committed by GitHub
parent 26f4b2a491
commit ac617e278e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 94 additions and 4 deletions

View file

@ -3546,7 +3546,21 @@ impl Editor {
window: &mut Window,
cx: &mut Context<Self>,
) {
if self.is_completion_trigger(text, trigger_in_words, cx) {
let ignore_completion_provider = self
.context_menu
.borrow()
.as_ref()
.map(|menu| match menu {
CodeContextMenu::Completions(completions_menu) => {
completions_menu.ignore_completion_provider
}
CodeContextMenu::CodeActions(_) => false,
})
.unwrap_or(false);
if ignore_completion_provider {
self.show_word_completions(&ShowWordCompletions, window, cx);
} else if self.is_completion_trigger(text, trigger_in_words, cx) {
self.show_completions(
&ShowCompletions {
trigger: Some(text.to_owned()).filter(|x| !x.is_empty()),
@ -4183,6 +4197,7 @@ impl Editor {
id,
sort_completions,
show_completion_documentation,
ignore_completion_provider,
position,
buffer.clone(),
completions.into(),