From 9264f7f88354c9da107aa78f4d9521041dc6b304 Mon Sep 17 00:00:00 2001 From: Cole Miller Date: Mon, 13 Apr 2026 13:09:56 -0400 Subject: [PATCH] git: Add missing `language_changed` notification for branch diffs (#53757) We need to reparse the base text using the same language as the main buffer, whenever the main buffer's language changed. We already do this for the uncommitted diff, but it was missing for the branch (OID-based) diffs. (We don't need it for the unstaged diff because we don't currently show you that base text anywhere in the UI, so its language is immaterial.) Self-Review Checklist: - [x] I've reviewed my own diff for quality, security, and reliability - [x] Unsafe blocks (if any) have justifying comments - [x] The content is consistent with the [UI/UX checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) - [ ] Tests cover the new/changed behavior - [x] Performance impact has been considered and is acceptable Release Notes: - N/A --- crates/project/src/git_store.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/crates/project/src/git_store.rs b/crates/project/src/git_store.rs index a00e2dcfc860d468795e15ad9d78df87d75f15e8..c760203dcdb8436bce9353b45f7d8ea20fa1eb78 100644 --- a/crates/project/src/git_store.rs +++ b/crates/project/src/git_store.rs @@ -3635,7 +3635,7 @@ impl BufferGitState { uncommitted_diff .update(cx, |diff, cx| { if language_changed { - diff.language_changed(language.clone(), language_registry, cx); + diff.language_changed(language.clone(), language_registry.clone(), cx); } diff.set_snapshot_with_secondary( new_uncommitted_diff, @@ -3664,7 +3664,12 @@ impl BufferGitState { .await; oid_diff - .update(cx, |diff, cx| diff.set_snapshot(new_oid_diff, &buffer, cx)) + .update(cx, |diff, cx| { + if language_changed { + diff.language_changed(language.clone(), language_registry.clone(), cx); + } + diff.set_snapshot(new_oid_diff, &buffer, cx) + }) .await; log::debug!(