Respect LSP completion triggers when copilot suggestion is on (#11401)

This commit is contained in:
Kirill Bulatov 2024-05-05 13:01:52 +03:00 committed by GitHub
parent 89039f6f34
commit 9ec0927701
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 137 additions and 13 deletions

View file

@ -2695,15 +2695,9 @@ impl Editor {
}
}
if had_active_inline_completion {
this.refresh_inline_completion(true, cx);
if !this.has_active_inline_completion(cx) {
this.trigger_completion_on_input(&text, cx);
}
} else {
this.trigger_completion_on_input(&text, cx);
this.refresh_inline_completion(true, cx);
}
let trigger_in_words = !had_active_inline_completion;
this.trigger_completion_on_input(&text, trigger_in_words, cx);
this.refresh_inline_completion(true, cx);
});
}
@ -3056,7 +3050,12 @@ impl Editor {
});
}
fn trigger_completion_on_input(&mut self, text: &str, cx: &mut ViewContext<Self>) {
fn trigger_completion_on_input(
&mut self,
text: &str,
trigger_in_words: bool,
cx: &mut ViewContext<Self>,
) {
if !EditorSettings::get_global(cx).show_completions_on_input {
return;
}
@ -3065,7 +3064,7 @@ impl Editor {
if self
.buffer
.read(cx)
.is_completion_trigger(selection.head(), text, cx)
.is_completion_trigger(selection.head(), text, trigger_in_words, cx)
{
self.show_completions(&ShowCompletions, cx);
} else {