From 954b5794ecbb8ad2b1b2ead4740a704a748f2ea5 Mon Sep 17 00:00:00 2001 From: "zed-zippy[bot]" <234243425+zed-zippy[bot]@users.noreply.github.com> Date: Thu, 18 Dec 2025 02:51:22 +0000 Subject: [PATCH] Always invalidate tree-sitter data on buffer reparse end (#45187) (cherry-pick to stable) (#45189) Cherry-pick of #45187 to stable ---- Also do not eagerly invalidate this data on buffer reparse start Closes https://github.com/zed-industries/zed/issues/45182 Release Notes: - Fixed bracket colorization not applied on initial file open Co-authored-by: Kirill Bulatov --- crates/language/src/buffer.rs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/crates/language/src/buffer.rs b/crates/language/src/buffer.rs index 9d856080404c37555b1111d341865caf04f8982c..1f0275248088ce4b8367cf6db7b241afc43a2dcf 100644 --- a/crates/language/src/buffer.rs +++ b/crates/language/src/buffer.rs @@ -1670,9 +1670,6 @@ impl Buffer { /// for the same buffer, we only initiate a new parse if we are not already /// parsing in the background. pub fn reparse(&mut self, cx: &mut Context, may_block: bool) { - if self.text.version() != *self.tree_sitter_data.version() { - self.invalidate_tree_sitter_data(self.text.snapshot()); - } if self.reparse.is_some() { return; } @@ -1774,9 +1771,7 @@ impl Buffer { self.syntax_map.lock().did_parse(syntax_snapshot); self.request_autoindent(cx); self.parse_status.0.send(ParseStatus::Idle).unwrap(); - if self.text.version() != *self.tree_sitter_data.version() { - self.invalidate_tree_sitter_data(self.text.snapshot()); - } + self.invalidate_tree_sitter_data(self.text.snapshot()); cx.emit(BufferEvent::Reparsed); cx.notify(); }