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

@ -1522,7 +1522,13 @@ impl MultiBuffer {
.map(|state| state.buffer.clone())
}
pub fn is_completion_trigger(&self, position: Anchor, text: &str, cx: &AppContext) -> bool {
pub fn is_completion_trigger(
&self,
position: Anchor,
text: &str,
trigger_in_words: bool,
cx: &AppContext,
) -> bool {
let mut chars = text.chars();
let char = if let Some(char) = chars.next() {
char
@ -1536,7 +1542,7 @@ impl MultiBuffer {
let snapshot = self.snapshot(cx);
let position = position.to_offset(&snapshot);
let scope = snapshot.language_scope_at(position);
if char_kind(&scope, char) == CharKind::Word {
if trigger_in_words && char_kind(&scope, char) == CharKind::Word {
return true;
}