Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Query char_kind for completion triggers.

Piotr Osiewiczccb9b5d27856
diff --git a/crates/editor/src/multi_buffer.rs b/crates/editor/src/multi_buffer.rs
index d4061f25dc6..510f591655c 100644
--- a/crates/editor/src/multi_buffer.rs
+++ b/crates/editor/src/multi_buffer.rs
@@ -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;
}