Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
agent: Register tracked buffers with language servers (#28610)
Agus Zubiagadafe994eef0e
diff --git a/crates/assistant_tool/src/action_log.rs b/crates/assistant_tool/src/action_log.rsindex 1c0911c1894..fa305a512ec 100644--- a/crates/assistant_tool/src/action_log.rs+++ b/crates/assistant_tool/src/action_log.rs@@ -4,7 +4,7 @@ use collections::BTreeMap;use futures::{StreamExt, channel::mpsc};use gpui::{App, AppContext, AsyncApp, Context, Entity, Subscription, Task, WeakEntity};use language::{Anchor, Buffer, BufferEvent, DiskState, Point};-use project::{Project, ProjectItem};+use project::{Project, ProjectItem, lsp_store::OpenLspBufferHandle};use std::{cmp, ops::Range, sync::Arc};use text::{Edit, Patch, Rope};use util::RangeExt;@@ -49,6 +49,10 @@ impl ActionLog {.tracked_buffers.entry(buffer.clone()).or_insert_with(|| {+ let open_lsp_handle = self.project.update(cx, |project, cx| {+ project.register_buffer_with_language_servers(&buffer, cx)+ });+let text_snapshot = buffer.read(cx).text_snapshot();let diff = cx.new(|cx| BufferDiff::new(&text_snapshot, cx));let (diff_update_tx, diff_update_rx) = mpsc::unbounded();@@ -76,6 +80,7 @@ impl ActionLog {version: buffer.read(cx).version(),diff,diff_update: diff_update_tx,+ _open_lsp_handle: open_lsp_handle,_maintain_diff: cx.spawn({let buffer = buffer.clone();async move |this, cx| {@@ -615,6 +620,7 @@ struct TrackedBuffer {diff: Entity<BufferDiff>,snapshot: text::BufferSnapshot,diff_update: mpsc::UnboundedSender<(ChangeAuthor, text::BufferSnapshot)>,+ _open_lsp_handle: OpenLspBufferHandle,_maintain_diff: Task<()>,_subscription: Subscription,}