Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

edit prediction: Try to fix panic in `Buffer::preview_edits` (#24654)

Bennet Bo Fenner8fa85c41a16b
diff --git a/crates/language/src/buffer.rs b/crates/language/src/buffer.rs
index defa935c282..826c6275672 100644
--- a/crates/language/src/buffer.rs
+++ b/crates/language/src/buffer.rs
@@ -1102,6 +1102,10 @@ impl Buffer {
let mut syntax_snapshot = self.syntax_map.lock().snapshot();
cx.background_executor().spawn(async move {
if !edits.is_empty() {
+ if let Some(language) = language.clone() {
+ syntax_snapshot.reparse(&old_snapshot, registry.clone(), language);
+ }
+
branch_buffer.edit(edits.iter().cloned());
let snapshot = branch_buffer.snapshot();
syntax_snapshot.interpolate(&snapshot);