agent_ui: Show global skill paths in edits summary (#57767)

Summary

- Display the full path for global skill files in the agent edits
summary when they do not have a project-relative file name.

Closes AI-320

Validation

- cargo check -p agent_ui --lib

Release Notes:

- Fixed global skill edits appearing without a file path in the agent
changes summary.
This commit is contained in:
MartinYe1234 2026-05-26 19:24:31 -07:00 committed by GitHub
parent 4129fc87d8
commit 867e51189b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -645,6 +645,15 @@ enum ToolCallLayout {
Embedded,
}
fn full_path_for_empty_project_path(file: &dyn language::File, cx: &App) -> Option<String> {
if file.path().file_name().is_some() {
return None;
}
let full_path = file.full_path(cx).display().to_string();
(!full_path.is_empty()).then_some(full_path)
}
impl ThreadView {
pub(crate) fn new(
root_thread_id: ThreadId,
@ -2703,6 +2712,9 @@ impl ThreadView {
let path_style = file.path_style(cx);
let separator = file.path_style(cx).primary_separator();
let fallback_full_path =
full_path_for_empty_project_path(file.as_ref(), cx);
let file_path = path.parent().and_then(|parent| {
if parent.is_empty() {
None
@ -2719,14 +2731,25 @@ impl ThreadView {
}
});
let file_name = path.file_name().map(|name| {
Label::new(name.to_string())
.size(LabelSize::XSmall)
.buffer_font(cx)
.ml_1()
});
let file_name = path
.file_name()
.map(|name| {
Label::new(name.to_string())
.size(LabelSize::XSmall)
.buffer_font(cx)
.ml_1()
})
.or_else(|| {
fallback_full_path.as_ref().map(|path| {
Label::new(path.clone())
.size(LabelSize::XSmall)
.buffer_font(cx)
.ml_1()
})
});
let full_path = path.display(path_style).to_string();
let full_path = fallback_full_path
.unwrap_or_else(|| path.display(path_style).to_string());
let file_icon = FileIcons::get_icon(path.as_std_path(), cx)
.map(Icon::from_path)