From 135143d51bc9cc4429d040b84651b59b4756ffda Mon Sep 17 00:00:00 2001 From: Agus Zubiaga Date: Wed, 2 Jul 2025 13:16:30 -0300 Subject: [PATCH] Rename display_name to label Co-authored-by: Antonio Scandurra Co-authored-by: Nathan Sobo Co-authored-by: Conrad Irwin --- crates/acp/src/acp.rs | 29 ++++++++++++----------------- crates/acp/src/server.rs | 4 ++-- crates/acp/src/thread_view.rs | 3 ++- 3 files changed, 16 insertions(+), 20 deletions(-) diff --git a/crates/acp/src/acp.rs b/crates/acp/src/acp.rs index 06faf048ecdacd6b8e9079cee5c511cb793f0760..9fbfc95f22c81510a0d777f881b29db07835eced 100644 --- a/crates/acp/src/acp.rs +++ b/crates/acp/src/acp.rs @@ -123,7 +123,7 @@ pub enum AgentThreadEntryContent { #[derive(Debug)] pub struct ToolCall { id: ToolCallId, - display_name: Entity, + label: Entity, status: ToolCallStatus, } @@ -271,7 +271,7 @@ impl AcpThread { pub fn request_tool_call( &mut self, - display_name: String, + label: String, confirmation: acp::ToolCallConfirmation, cx: &mut Context, ) -> ToolCallRequest { @@ -282,22 +282,22 @@ impl AcpThread { respond_tx: tx, }; - let id = self.insert_tool_call(display_name, status, cx); + let id = self.insert_tool_call(label, status, cx); ToolCallRequest { id, outcome: rx } } - pub fn push_tool_call(&mut self, display_name: String, cx: &mut Context) -> ToolCallId { + pub fn push_tool_call(&mut self, label: String, cx: &mut Context) -> ToolCallId { let status = ToolCallStatus::Allowed { status: acp::ToolCallStatus::Running, content: None, }; - self.insert_tool_call(display_name, status, cx) + self.insert_tool_call(label, status, cx) } fn insert_tool_call( &mut self, - display_name: String, + label: String, status: ToolCallStatus, cx: &mut Context, ) -> ToolCallId { @@ -307,13 +307,8 @@ impl AcpThread { AgentThreadEntryContent::ToolCall(ToolCall { // todo! clean up id creation id: ToolCallId(ThreadEntryId(self.entries.len() as u64)), - display_name: cx.new(|cx| { - Markdown::new( - display_name.into(), - Some(language_registry.clone()), - None, - cx, - ) + label: cx.new(|cx| { + Markdown::new(label.into(), Some(language_registry.clone()), None, cx) }), status, }), @@ -525,7 +520,7 @@ mod tests { .unwrap(); thread.read_with(cx, |thread, cx| { let AgentThreadEntryContent::ToolCall(ToolCall { - display_name, + label, status: ToolCallStatus::Allowed { .. }, .. }) = &thread.entries()[1].content @@ -533,7 +528,7 @@ mod tests { panic!(); }; - display_name.read_with(cx, |md, _cx| { + label.read_with(cx, |md, _cx| { assert_eq!(md.source(), "ReadFile"); }); @@ -566,7 +561,7 @@ mod tests { let tool_call_id = thread.read_with(cx, |thread, cx| { let AgentThreadEntryContent::ToolCall(ToolCall { id, - display_name, + label, status: ToolCallStatus::WaitingForConfirmation { confirmation: acp::ToolCallConfirmation::Execute { root_command, .. }, @@ -579,7 +574,7 @@ mod tests { assert_eq!(root_command, "echo"); - display_name.read_with(cx, |md, _cx| { + label.read_with(cx, |md, _cx| { assert_eq!(md.source(), "Shell"); }); diff --git a/crates/acp/src/server.rs b/crates/acp/src/server.rs index 98bb3c35e5d0babf2fa86827184299888e473909..93ee4d1c137e9e24560d246ec8da898526f59cdc 100644 --- a/crates/acp/src/server.rs +++ b/crates/acp/src/server.rs @@ -185,7 +185,7 @@ impl acp::Client for AcpClientDelegate { let ToolCallRequest { id, outcome } = cx .update(|cx| { self.update_thread(&request.thread_id.into(), cx, |thread, cx| { - thread.request_tool_call(request.display_name, request.confirmation, cx) + thread.request_tool_call(request.label, request.confirmation, cx) }) })? .context("Failed to update thread")?; @@ -204,7 +204,7 @@ impl acp::Client for AcpClientDelegate { let entry_id = cx .update(|cx| { self.update_thread(&request.thread_id.into(), cx, |thread, cx| { - thread.push_tool_call(request.display_name, cx) + thread.push_tool_call(request.label, cx) }) })? .context("Failed to update thread")?; diff --git a/crates/acp/src/thread_view.rs b/crates/acp/src/thread_view.rs index 58f0fca6a675690912cba442b388d7042f0bd750..e3a9073e824407b40cdcc5ad499c11f0aedf951a 100644 --- a/crates/acp/src/thread_view.rs +++ b/crates/acp/src/thread_view.rs @@ -328,8 +328,9 @@ impl AcpThreadView { .size(IconSize::Small) .color(Color::Muted), ) + // todo! danilo please help .child(MarkdownElement::new( - tool_call.display_name.clone(), + tool_call.label.clone(), default_markdown_style(window, cx), )) .child(div().w_full())