Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
SyntaxMap - Don't ignore deletions at the boundaries of layers
Max Brunsfeldee66adbb492b
diff --git a/crates/language/src/syntax_map.rs b/crates/language/src/syntax_map.rsindex 026e4857c54..d843f5e85b0 100644--- a/crates/language/src/syntax_map.rs+++ b/crates/language/src/syntax_map.rs@@ -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")