diff --git a/helix-core/src/indent.rs b/helix-core/src/indent.rs index a1e2c8640..befbb06f5 100644 --- a/helix-core/src/indent.rs +++ b/helix-core/src/indent.rs @@ -297,7 +297,7 @@ fn is_first_in_line(node: &Node, text: RopeSlice, new_line_byte_pos: Option #[derive(Debug, Default)] pub struct IndentQueryPredicates { - not_kind_eq: Option<(Capture, Box)>, + not_kind_eq: Vec<(Capture, Box)>, same_line: Option<(Capture, Capture, bool)>, one_line: Option<(Capture, bool)>, } @@ -309,12 +309,9 @@ impl IndentQueryPredicates { text: RopeSlice, new_line_byte_pos: Option, ) -> bool { - if let Some((capture, not_expected_kind)) = self.not_kind_eq.as_ref() { - if !match_ - .nodes_for_capture(*capture) - .next() - .is_some_and(|node| node.kind() != not_expected_kind.as_ref()) - { + for (capture, not_expected_kind) in self.not_kind_eq.iter() { + let node = match_.nodes_for_capture(*capture).next(); + if node.is_some_and(|n| n.kind() == not_expected_kind.as_ref()) { return false; } } @@ -394,8 +391,11 @@ impl IndentQuery { let capture = predicate.capture_arg(0)?; let not_expected_kind = predicate.str_arg(1)?; - predicates.entry(pattern).or_default().not_kind_eq = - Some((capture, not_expected_kind.to_string().into_boxed_str())); + predicates + .entry(pattern) + .or_default() + .not_kind_eq + .push((capture, not_expected_kind.into())); Ok(()) } "same-line?" | "not-same-line?" => {