acp: Use file icons for edit tool cards when ToolCallLocation is known (#36684)

Release Notes:

- N/A
This commit is contained in:
Bennet Bo Fenner 2025-08-21 16:18:22 +02:00 committed by Joseph T. Lyons
parent 129b93ace9
commit 79064d1fb8

View file

@ -1469,19 +1469,26 @@ impl AcpThreadView {
tool_call: &ToolCall, tool_call: &ToolCall,
cx: &Context<Self>, cx: &Context<Self>,
) -> Div { ) -> Div {
let tool_icon = Icon::new(match tool_call.kind { let tool_icon =
acp::ToolKind::Read => IconName::ToolRead, if tool_call.kind == acp::ToolKind::Edit && tool_call.locations.len() == 1 {
acp::ToolKind::Edit => IconName::ToolPencil, FileIcons::get_icon(&tool_call.locations[0].path, cx)
acp::ToolKind::Delete => IconName::ToolDeleteFile, .map(Icon::from_path)
acp::ToolKind::Move => IconName::ArrowRightLeft, .unwrap_or(Icon::new(IconName::ToolPencil))
acp::ToolKind::Search => IconName::ToolSearch, } else {
acp::ToolKind::Execute => IconName::ToolTerminal, Icon::new(match tool_call.kind {
acp::ToolKind::Think => IconName::ToolThink, acp::ToolKind::Read => IconName::ToolRead,
acp::ToolKind::Fetch => IconName::ToolWeb, acp::ToolKind::Edit => IconName::ToolPencil,
acp::ToolKind::Other => IconName::ToolHammer, acp::ToolKind::Delete => IconName::ToolDeleteFile,
}) acp::ToolKind::Move => IconName::ArrowRightLeft,
.size(IconSize::Small) acp::ToolKind::Search => IconName::ToolSearch,
.color(Color::Muted); acp::ToolKind::Execute => IconName::ToolTerminal,
acp::ToolKind::Think => IconName::ToolThink,
acp::ToolKind::Fetch => IconName::ToolWeb,
acp::ToolKind::Other => IconName::ToolHammer,
})
}
.size(IconSize::Small)
.color(Color::Muted);
let base_container = h_flex().size_4().justify_center(); let base_container = h_flex().size_4().justify_center();