mirror of
https://github.com/zed-industries/zed.git
synced 2025-02-06 18:46:49 +00:00
Query char_kind for completion triggers.
Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
This commit is contained in:
parent
168a213a44
commit
ccb9b5d278
1 changed files with 4 additions and 4 deletions
|
@ -1346,9 +1346,7 @@ impl MultiBuffer {
|
||||||
.map(|state| state.buffer.clone())
|
.map(|state| state.buffer.clone())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn is_completion_trigger<T>(&self, position: T, text: &str, cx: &AppContext) -> bool
|
pub fn is_completion_trigger(&self, position: Anchor, text: &str, cx: &AppContext) -> bool
|
||||||
where
|
|
||||||
T: ToOffset,
|
|
||||||
{
|
{
|
||||||
let mut chars = text.chars();
|
let mut chars = text.chars();
|
||||||
let char = if let Some(char) = chars.next() {
|
let char = if let Some(char) = chars.next() {
|
||||||
|
@ -1360,7 +1358,9 @@ impl MultiBuffer {
|
||||||
return false;
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue