SyntaxMap - Don't ignore deletions at the boundaries of layers

This commit is contained in:
Max Brunsfeld 2022-11-11 16:43:57 -08:00
parent 3612c46d6d
commit ee66adbb49

View File

@ -453,10 +453,9 @@ impl SyntaxSnapshot {
Some(old_layer.tree.clone()),
);
changed_ranges = join_ranges(
edits
.iter()
.map(|e| e.new.clone())
.filter(|range| range.start < step_end_byte && range.end > step_start_byte),
edits.iter().map(|e| e.new.clone()).filter(|range| {
range.start <= step_end_byte && range.end >= step_start_byte
}),
old_layer
.tree
.changed_ranges(&tree)
@ -1919,6 +1918,31 @@ mod tests {
);
}
#[gpui::test]
fn test_combined_injections_splitting_some_injections() {
let (_buffer, _syntax_map) = test_edit_sequence(
"ERB",
&[
r#"
<%A if b(:c) %>
d
<% end %>
eee
<% f %>
"#,
r#"
<%« AAAAAAA %>
hhhhhhh
<%=» if b(:c) %>
d
<% end %>
eee
<% f %>
"#,
],
);
}
#[gpui::test(iterations = 50)]
fn test_random_syntax_map_edits(mut rng: StdRng) {
let operations = env::var("OPERATIONS")