MCPcopy Index your code
hub / github.com/ChrisFeldmeier/OpenCodeRust / render

Method render

crates/opencode-tui/src/components/tool_call.rs:56–116  ·  view source on GitHub ↗
(&self, frame: &mut Frame, area: Rect, theme: &Theme)

Source from the content-addressed store, hash-verified

54 }
55
56 pub fn render(&self, frame: &mut Frame, area: Rect, theme: &Theme) {
57 let status_icon = match self.tool_call.status {
58 ToolCallStatus::Pending => "◯",
59 ToolCallStatus::Running => "◐",
60 ToolCallStatus::Completed => "●",
61 ToolCallStatus::Failed => "✗",
62 };
63
64 let status_color = match self.tool_call.status {
65 ToolCallStatus::Pending => theme.text_muted,
66 ToolCallStatus::Running => theme.warning,
67 ToolCallStatus::Completed => theme.success,
68 ToolCallStatus::Failed => theme.error,
69 };
70
71 let title_line = Line::from(vec![
72 Span::styled(status_icon, Style::default().fg(status_color)),
73 Span::raw(" "),
74 Span::styled(
75 &self.tool_call.name,
76 Style::default()
77 .fg(theme.primary)
78 .add_modifier(Modifier::BOLD),
79 ),
80 Span::styled(
81 match self.tool_call.status {
82 ToolCallStatus::Pending => " (pending)",
83 ToolCallStatus::Running => " (running...)",
84 ToolCallStatus::Completed => " (completed)",
85 ToolCallStatus::Failed => " (failed)",
86 },
87 Style::default().fg(theme.text_muted),
88 ),
89 ]);
90
91 let mut lines = vec![title_line];
92
93 if !self.tool_call.arguments.is_empty() {
94 lines.push(Line::from(""));
95 for line in self.tool_call.arguments.lines().take(5) {
96 lines.push(Line::from(Span::styled(
97 format!(" {}", line),
98 Style::default().fg(theme.text_muted),
99 )));
100 }
101 if self.tool_call.arguments.lines().count() > 5 {
102 lines.push(Line::from(Span::styled(
103 " ...",
104 Style::default().fg(theme.text_muted),
105 )));
106 }
107 }
108
109 let paragraph = Paragraph::new(lines).block(
110 Block::default()
111 .borders(Borders::LEFT)
112 .border_style(Style::default().fg(status_color)),
113 );

Callers

nothing calls this directly

Calls 4

newFunction · 0.85
is_emptyMethod · 0.80
countMethod · 0.80
cloneMethod · 0.45

Tested by

no test coverage detected