Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Show "full" paths in the /file command output (#15483)

Kirill Bulatov1bfea9d443c7
diff --git a/crates/assistant/src/slash_command/file_command.rs b/crates/assistant/src/slash_command/file_command.rs
index c70c44fe52e..af35bacd2a5 100644
--- a/crates/assistant/src/slash_command/file_command.rs
+++ b/crates/assistant/src/slash_command/file_command.rs
@@ -273,20 +273,25 @@ fn collect_files(
continue;
};
if let Some(buffer) = open_buffer_task.await.log_err() {
- let snapshot = cx.read_model(&buffer, |buffer, _| buffer.snapshot())?;
+ let buffer_snapshot =
+ cx.read_model(&buffer, |buffer, _| buffer.snapshot())?;
let prev_len = text.len();
- collect_file_content(&mut text, &snapshot, filename.clone());
+ collect_file_content(
+ &mut text,
+ &buffer_snapshot,
+ path_including_worktree_name.to_string_lossy().to_string(),
+ );
text.push('\n');
if !write_single_file_diagnostics(
&mut text,
Some(&path_including_worktree_name),
- &snapshot,
+ &buffer_snapshot,
) {
text.pop();
}
ranges.push((
prev_len..text.len(),
- PathBuf::from(filename),
+ path_including_worktree_name,
EntryType::File,
));
text.push('\n');