Query char_kind for completion triggers.

Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
This commit is contained in:
Piotr Osiewicz 2023-08-22 18:12:05 +02:00
parent 168a213a44
commit ccb9b5d278

View file

@ -1346,9 +1346,7 @@ impl MultiBuffer {
.map(|state| state.buffer.clone())
}
pub fn is_completion_trigger<T>(&self, position: T, text: &str, cx: &AppContext) -> bool
where
T: ToOffset,
pub fn is_completion_trigger(&self, position: Anchor, text: &str, cx: &AppContext) -> bool
{
let mut chars = text.chars();
let char = if let Some(char) = chars.next() {
@ -1360,7 +1358,9 @@ impl MultiBuffer {
return false;
}
if char.is_alphanumeric() || char == '_' {
let language = self.language_at(position.clone(), cx);
if char_kind(language.as_ref(), char) == CharKind::Word {
return true;
}