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.

acp_thread: Await Tree-sitter parsing before building agent panel diffs (#49101)

chenwuji2000-cybercbf03f5b38d2
diff --git a/crates/acp_thread/src/diff.rs b/crates/acp_thread/src/diff.rs
index 9e47e70814b..8886b458d62 100644
--- a/crates/acp_thread/src/diff.rs
+++ b/crates/acp_thread/src/diff.rs
@@ -36,6 +36,7 @@ impl Diff {
.log_err();
buffer.update(cx, |buffer, cx| buffer.set_language(language.clone(), cx));
+ buffer.update(cx, |buffer, _| buffer.parsing_idle()).await;
let diff = build_buffer_diff(
old_text.unwrap_or("".into()).into(),
@@ -287,6 +288,7 @@ impl PendingDiff {
let buffer_diff = cx.spawn({
let buffer = buffer.clone();
async move |_this, cx| {
+ buffer.update(cx, |buffer, _| buffer.parsing_idle()).await;
build_buffer_diff(base_text, &buffer, language_registry, cx).await
}
});