From 2fdf91c3c22ec4900c3ee85f24306f25ba1d899c Mon Sep 17 00:00:00 2001 From: Cole Miller Date: Mon, 5 Jan 2026 20:29:30 -0500 Subject: [PATCH] Ensure language is set on diffs from `ActionLog` and `AcpThread` (#46129) Release Notes: - N/A --- crates/acp_thread/src/diff.rs | 9 ++++++++- crates/action_log/src/action_log.rs | 8 +++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/crates/acp_thread/src/diff.rs b/crates/acp_thread/src/diff.rs index fc0fff5318..f65893a87d 100644 --- a/crates/acp_thread/src/diff.rs +++ b/crates/acp_thread/src/diff.rs @@ -86,9 +86,16 @@ impl Diff { pub fn new(buffer: Entity, cx: &mut Context) -> Self { let buffer_text_snapshot = buffer.read(cx).text_snapshot(); + let language = buffer.read(cx).language().cloned(); + let language_registry = buffer.read(cx).language_registry(); let buffer_diff = cx.new(|cx| { let mut diff = BufferDiff::new_unchanged(&buffer_text_snapshot, cx); - let secondary_diff = cx.new(|cx| BufferDiff::new_unchanged(&buffer_text_snapshot, cx)); + diff.language_changed(language.clone(), language_registry.clone(), cx); + let secondary_diff = cx.new(|cx| { + let mut diff = BufferDiff::new_unchanged(&buffer_text_snapshot, cx); + diff.language_changed(language, language_registry, cx); + diff + }); diff.set_secondary_diff(secondary_diff); diff }); diff --git a/crates/action_log/src/action_log.rs b/crates/action_log/src/action_log.rs index c5a649d667..801765bb88 100644 --- a/crates/action_log/src/action_log.rs +++ b/crates/action_log/src/action_log.rs @@ -79,7 +79,13 @@ impl ActionLog { }); let text_snapshot = buffer.read(cx).text_snapshot(); - let diff = cx.new(|cx| BufferDiff::new(&text_snapshot, cx)); + let language = buffer.read(cx).language().cloned(); + let language_registry = buffer.read(cx).language_registry(); + let diff = cx.new(|cx| { + let mut diff = BufferDiff::new(&text_snapshot, cx); + diff.language_changed(language, language_registry, cx); + diff + }); let (diff_update_tx, diff_update_rx) = mpsc::unbounded(); let diff_base; let unreviewed_edits;