mirror of
https://github.com/Myriad-Dreamin/tinymist.git
synced 2025-08-03 01:42:14 +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
|
// Do some completion specific to the deref target
|
||||||
let mut ident_like = None;
|
let mut ident_like = None;
|
||||||
let mut completion_result = None;
|
let mut completion_result = None;
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
/// contains: top-edge
|
||||||
|
#text(size: 1p/* range 0..1 */)
|
|
@ -0,0 +1,10 @@
|
||||||
|
---
|
||||||
|
source: crates/tinymist-query/src/completion.rs
|
||||||
|
description: Completion on / (37..38)
|
||||||
|
expression: "JsonRepr::new_pure(results)"
|
||||||
|
input_file: crates/tinymist-query/src/fixtures/completion/edit_length.typ
|
||||||
|
snapshot_kind: text
|
||||||
|
---
|
||||||
|
[
|
||||||
|
null
|
||||||
|
]
|
Loading…
Add table
Add a link
Reference in a new issue