mirror of
https://github.com/Myriad-Dreamin/tinymist.git
synced 2025-07-23 12:45:04 +00:00
fix: skip code completion when editing length (#882)
This commit is contained in:
parent
49d33e5047
commit
422971c8b6
3 changed files with 33 additions and 0 deletions
|
@ -101,6 +101,27 @@ impl StatefulRequest for CompletionRequest {
|
|||
}
|
||||
}
|
||||
|
||||
// Skip if an error node starts with number (e.g. `1pt`)
|
||||
if matches!(
|
||||
deref_target,
|
||||
Some(DerefTarget::Callee(..) | DerefTarget::VarAccess(..) | DerefTarget::Normal(..),)
|
||||
) {
|
||||
let node = LinkedNode::new(source.root()).leaf_at_compat(cursor)?;
|
||||
if node.erroneous() {
|
||||
let mut n = node.text().chars();
|
||||
|
||||
match n.next() {
|
||||
Some(c) if c.is_numeric() => return None,
|
||||
Some('.') => {
|
||||
if matches!(n.next(), Some(c) if c.is_numeric()) {
|
||||
return None;
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Do some completion specific to the deref target
|
||||
let mut ident_like = None;
|
||||
let mut completion_result = None;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue