From 1bfea9d443c70701956e03816eb6d2d5682b2ec4 Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Tue, 30 Jul 2024 17:03:16 +0300 Subject: [PATCH] Show "full" paths in the /file command output (#15483) Same as /tabs command outputs them Before: ![Screenshot 2024-07-30 at 16 52 11](https://github.com/user-attachments/assets/acf1c79e-4607-41fc-bd5e-b20dc668eff4) ![Screenshot 2024-07-30 at 16 52 03](https://github.com/user-attachments/assets/dd7fa42f-3ba8-4f1c-9420-2a0246df64b7) After: ![Screenshot 2024-07-30 at 16 53 16](https://github.com/user-attachments/assets/ee866ecb-2142-4303-9385-c6b856310d43) ![Screenshot 2024-07-30 at 16 53 21](https://github.com/user-attachments/assets/d42b9c77-d5e9-4aaf-8de9-3b160078e622) Release Notes: - N/A --- crates/assistant/src/slash_command/file_command.rs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/crates/assistant/src/slash_command/file_command.rs b/crates/assistant/src/slash_command/file_command.rs index c70c44fe52e18f127e888892cc053df213b911c8..af35bacd2a5c99813fa2e215de1cda8894e04c41 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');