Always invalidate tree-sitter data on buffer reparse end (#45187) (cherry-pick to preview) (#45190)
zed-zippy[bot]
and
Kirill Bulatov
created
Cherry-pick of #45187 to preview
----
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 <kirill@zed.dev>
@@ -1672,9 +1672,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<Self>, 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;
}
@@ -1776,9 +1773,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();
}