mirror of
https://github.com/Myriad-Dreamin/tinymist.git
synced 2025-08-03 01:42:14 +00:00
fix: add more kind checking about MathText
(#1415)
This commit is contained in:
parent
8da796c8bc
commit
4c06ffeaa9
4 changed files with 5 additions and 4 deletions
|
@ -746,7 +746,8 @@ pub fn classify_syntax(node: LinkedNode, cursor: usize) -> Option<SyntaxClass<'_
|
|||
}
|
||||
}
|
||||
|
||||
if matches!(node.kind(), SyntaxKind::Text) {
|
||||
// todo: check if we can remove Text here
|
||||
if matches!(node.kind(), SyntaxKind::Text | SyntaxKind::MathText) {
|
||||
let mode = interpret_mode_at(Some(&node));
|
||||
if matches!(mode, InterpretMode::Math) && is_ident_like(&node) {
|
||||
return Some(SyntaxClass::VarAccess(VarClass::Ident(node)));
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue