fix: add more kind checking about MathText (#1415)

This commit is contained in:
Myriad-Dreamin 2025-02-27 11:41:30 +08:00 committed by GitHub
parent 8da796c8bc
commit 4c06ffeaa9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 5 additions and 4 deletions

View file

@ -79,7 +79,7 @@ impl SemanticRequest for InteractCodeContextRequest {
let mut leaf = root.leaf_at_compat(cursor)?;
log::info!("style at leaf {leaf:?} . {style:?}");
if leaf.kind() != SyntaxKind::Text {
if !matches!(leaf.kind(), SyntaxKind::Text | SyntaxKind::MathText) {
return None;
}

View file

@ -18,7 +18,7 @@ pub fn jump_from_cursor(
match document {
TypstDocument::Paged(paged_doc) => {
let node = LinkedNode::new(source.root()).leaf_at_compat(cursor)?;
if node.kind() != SyntaxKind::Text {
if matches!(node.kind(), SyntaxKind::Text | SyntaxKind::MathText) {
return None;
}