feat: identify identifier-like text as ident in math mode (#1138)

This commit is contained in:
Myriad-Dreamin 2025-01-09 18:50:03 +08:00 committed by GitHub
parent 34fe823ab7
commit fcb9fec712
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -676,6 +676,13 @@ pub fn classify_syntax(node: LinkedNode, cursor: usize) -> Option<SyntaxClass<'_
}
}
if matches!(node.kind(), SyntaxKind::Text) {
let mode = interpret_mode_at(Some(&node));
if matches!(mode, InterpretMode::Math) && is_ident_like(&node) {
return Some(SyntaxClass::VarAccess(VarClass::Ident(node)));
}
}
// Move to the first ancestor that is an expression.
let ancestor = first_ancestor_expr(node)?;
crate::log_debug_ct!("first_ancestor_expr: {ancestor:?}");