diff --git a/helix-core/src/syntax/tree_cursor.rs b/helix-core/src/syntax/tree_cursor.rs index 692d5890a..bec4a1c6c 100644 --- a/helix-core/src/syntax/tree_cursor.rs +++ b/helix-core/src/syntax/tree_cursor.rs @@ -204,7 +204,7 @@ impl<'a> TreeCursor<'a> { self.injection_ranges[start_idx..] .iter() - .take_while(|range| range.start < end) + .take_while(|range| range.start < end || range.depth > 1) .find_map(|range| (range.start <= start).then_some(range.layer_id)) .unwrap_or(self.root) }