agent: Don't render Markdown for file names in tool calls (#49668)
Closes #44184 Closes #45729 Before (incorrect; __init__ is bold): <img width="391" height="87" alt="image" src="https://github.com/user-attachments/assets/f453dbf1-224f-49fe-9d94-d0d83ad68ac5" /> After (\_\_init\_\_ renders correctly): <img width="385" height="80" alt="image" src="https://github.com/user-attachments/assets/1f7892f1-559a-436b-bde1-00c5c3bce8de" /> Release Notes: - Agent: Fix rendering of filenames in edit tool header
This commit is contained in:
1 parent
35a290a28c
commit
f26f543f7c
1 file changed
+5
@@ -31,6 +31,7 @@ use task::{Shell, ShellBuilder};
|
||||
pub use terminal::*;
|
||||
use text::Bias;
|
||||
use ui::App;
|
||||
use util::markdown::MarkdownEscaped;
|
||||
use util::path_list::PathList;
|
||||
use util::{ResultExt, get_default_system_shell_preferring_bash, paths::PathStyle};
|
||||
use uuid::Uuid;
|
||||
@@ -246,6 +247,8 @@ impl ToolCall {
|
||||
) -> Result<Self> {
|
||||
let title = if tool_call.kind == acp::ToolKind::Execute {
|
||||
tool_call.title
|
||||
} else if tool_call.kind == acp::ToolKind::Edit {
|
||||
MarkdownEscaped(tool_call.title.as_str()).to_string()
|
||||
} else if let Some((first_line, _)) = tool_call.title.split_once("\n") {
|
||||
first_line.to_owned() + "…"
|
||||
} else {
|
||||
@@ -334,6 +337,8 @@ impl ToolCall {
|
||||
self.label.update(cx, |label, cx| {
|
||||
if self.kind == acp::ToolKind::Execute {
|
||||
label.replace(title, cx);
|
||||
} else if self.kind == acp::ToolKind::Edit {
|
||||
label.replace(MarkdownEscaped(&title).to_string(), cx)
|
||||
} else if let Some((first_line, _)) = title.split_once("\n") {
|
||||
label.replace(first_line.to_owned() + "…", cx);
|
||||
} else {
|
||||
|
||||
Reference in new issue
Block a user