diff --git a/crates/tinymist-analysis/src/syntax/matcher.rs b/crates/tinymist-analysis/src/syntax/matcher.rs index 8a3c7dce..338043f9 100644 --- a/crates/tinymist-analysis/src/syntax/matcher.rs +++ b/crates/tinymist-analysis/src/syntax/matcher.rs @@ -746,7 +746,8 @@ pub fn classify_syntax(node: LinkedNode, cursor: usize) -> Option { 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; } diff --git a/crates/tinymist/src/tool/preview.rs b/crates/tinymist/src/tool/preview.rs index a127e104..b1b57fae 100644 --- a/crates/tinymist/src/tool/preview.rs +++ b/crates/tinymist/src/tool/preview.rs @@ -85,7 +85,7 @@ impl typst_preview::CompileView for PreviewCompileView { source.line_column_to_byte(loc.pos.line as usize, loc.pos.character as usize)?; 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; } let span = node.span();