This commit is locking up diagnostics on Zed eccdfed32b6cfd3d7bb687e32f2c1de7665afb31

Nathan Sobo created

Change summary

Cargo.lock                               |  6 ----
Cargo.toml                               |  2 
crates/acp_thread/src/acp_thread.rs      | 30 +++++++++++++------------
crates/agent_ui/src/acp.rs               |  1 
crates/agent_ui/src/acp/thread_editor.rs |  6 +++++
5 files changed, 25 insertions(+), 20 deletions(-)

Detailed changes

Cargo.lock 🔗

@@ -211,8 +211,6 @@ dependencies = [
 [[package]]
 name = "agent-client-protocol"
 version = "0.7.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "525705e39c11cd73f7bc784e3681a9386aa30c8d0630808d3dc2237eb4f9cb1b"
 dependencies = [
  "agent-client-protocol-schema",
  "anyhow",
@@ -228,9 +226,7 @@ dependencies = [
 
 [[package]]
 name = "agent-client-protocol-schema"
-version = "0.6.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ecf16c18fea41282d6bbadd1549a06be6836bddb1893f44a6235f340fa24e2af"
+version = "0.6.3"
 dependencies = [
  "anyhow",
  "derive_more 2.0.1",

Cargo.toml 🔗

@@ -440,7 +440,7 @@ zlog_settings = { path = "crates/zlog_settings" }
 # External crates
 #
 
-agent-client-protocol = { version = "0.7.0", features = ["unstable"] }
+agent-client-protocol = { path = "../agent-client-protocol", features = ["unstable"] }
 aho-corasick = "1.1"
 alacritty_terminal = "0.25.1-rc1"
 any_vec = "0.14"

crates/acp_thread/src/acp_thread.rs 🔗

@@ -38,10 +38,10 @@ use util::{ResultExt, get_default_system_shell_preferring_bash, paths::PathStyle
 use uuid::Uuid;
 
 #[derive(Debug)]
-pub struct UserMessage {
+pub struct UserMessage<T> {
     pub id: Option<UserMessageId>,
     pub content: ContentBlock,
-    pub chunks: Vec<acp::ContentBlock>,
+    pub chunks: Vec<acp::ContentBlock<T>>,
     pub checkpoint: Option<Checkpoint>,
 }
 
@@ -51,7 +51,7 @@ pub struct Checkpoint {
     pub show: bool,
 }
 
-impl UserMessage {
+impl<T> UserMessage<T> {
     fn to_markdown(&self, cx: &App) -> String {
         let mut markdown = String::new();
         if self
@@ -116,13 +116,13 @@ impl AssistantMessageChunk {
 }
 
 #[derive(Debug)]
-pub enum AgentThreadEntry {
-    UserMessage(UserMessage),
+pub enum AgentThreadEntry<T> {
+    UserMessage(UserMessage<T>),
     AssistantMessage(AssistantMessage),
     ToolCall(ToolCall),
 }
 
-impl AgentThreadEntry {
+impl<T> AgentThreadEntry<T> {
     pub fn to_markdown(&self, cx: &App) -> String {
         match self {
             Self::UserMessage(message) => message.to_markdown(cx),
@@ -131,7 +131,7 @@ impl AgentThreadEntry {
         }
     }
 
-    pub fn user_message(&self) -> Option<&UserMessage> {
+    pub fn user_message(&self) -> Option<&UserMessage<T>> {
         if let AgentThreadEntry::UserMessage(message) = self {
             Some(message)
         } else {
@@ -802,9 +802,11 @@ pub struct RetryStatus {
     pub duration: Duration,
 }
 
-pub struct AcpThread {
-    title: SharedString,
-    entries: Vec<AgentThreadEntry>,
+pub struct AnchoredText;
+
+pub struct AcpThread<T = SharedString> {
+    title: T,
+    entries: Vec<AgentThreadEntry<AnchoredText>>,
     plan: Plan,
     project: Entity<Project>,
     action_log: Entity<ActionLog>,
@@ -1002,7 +1004,7 @@ impl Display for LoadError {
 
 impl Error for LoadError {}
 
-impl AcpThread {
+impl<T> AcpThread<T> {
     pub fn new(
         title: impl Into<SharedString>,
         connection: Rc<dyn AgentConnection>,
@@ -1152,7 +1154,7 @@ impl AcpThread {
     pub fn push_user_content_block(
         &mut self,
         message_id: Option<UserMessageId>,
-        chunk: acp::ContentBlock,
+        chunk: acp::ContentBlock<T>,
         cx: &mut Context<Self>,
     ) {
         let language_registry = self.project.read(cx).languages().clone();
@@ -1231,7 +1233,7 @@ impl AcpThread {
         }
     }
 
-    fn push_entry(&mut self, entry: AgentThreadEntry, cx: &mut Context<Self>) {
+    fn push_entry(&mut self, entry: AgentThreadEntry<T>, cx: &mut Context<Self>) {
         self.entries.push(entry);
         cx.emit(AcpThreadEvent::NewEntry);
     }
@@ -1924,7 +1926,7 @@ impl AcpThread {
         })
     }
 
-    fn last_user_message(&mut self) -> Option<(usize, &mut UserMessage)> {
+    fn last_user_message(&mut self) -> Option<(usize, &mut UserMessage<T>)> {
         self.entries
             .iter_mut()
             .enumerate()

crates/agent_ui/src/acp.rs 🔗

@@ -4,6 +4,7 @@ mod message_editor;
 mod mode_selector;
 mod model_selector;
 mod model_selector_popover;
+mod thread_editor;
 mod thread_history;
 mod thread_view;