Skip to content

Commit

Permalink
fix crash when encountering overlapping injections
Browse files Browse the repository at this point in the history
  • Loading branch information
pascalkuthe committed Jul 13, 2023
1 parent e86bb64 commit 0957a54
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions helix-core/src/syntax.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1136,6 +1136,7 @@ impl Syntax {
RopeProvider(source_slice),
);
let mut injections = Vec::new();
let mut last_injection_end = 0;
for mat in matches {
let (injection_capture, content_node, included_children) = layer
.config
Expand All @@ -1150,6 +1151,11 @@ impl Syntax {
if let (Some(injection_capture), Some(content_node)) =
(injection_capture, content_node)
{
if content_node.start_byte() < last_injection_end {
continue;
}
last_injection_end = content_node.end_byte();

if let Some(config) = (injection_callback)(&injection_capture) {
let ranges =
intersect_ranges(&layer.ranges, &[content_node], included_children);
Expand Down

0 comments on commit 0957a54

Please sign in to comment.