From 5343f1cdafa815130d3dab7f4b1818b0e17c8838 Mon Sep 17 00:00:00 2001 From: Michael Sloan Date: Tue, 1 Apr 2025 01:43:40 -0600 Subject: [PATCH] Undo a refactor of `buffer_path_log_err` (#27828) Accidentally included this in #27822 Release Notes: - N/A --- crates/assistant2/src/context_store.rs | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/crates/assistant2/src/context_store.rs b/crates/assistant2/src/context_store.rs index 8fdc53e53acf453cc898d82fc7e52caadddf7cea..e4ef3da196d2ce2ce171cb593e0ba1748e554ffc 100644 --- a/crates/assistant2/src/context_store.rs +++ b/crates/assistant2/src/context_store.rs @@ -633,21 +633,17 @@ fn collect_buffer_info_and_text( pub fn buffer_path_log_err(buffer: &Buffer, cx: &App) -> Option> { if let Some(file) = buffer.file() { - Some(file_path(file, cx)) + let mut path = file.path().clone(); + if path.as_os_str().is_empty() { + path = file.full_path(cx).into(); + } + Some(path) } else { log::error!("Buffer that had a path unexpectedly no longer has a path."); None } } -pub fn file_path(file: &Arc, cx: &App) -> Arc { - let mut path = file.path().clone(); - if path.as_os_str().is_empty() { - path = file.full_path(cx).into(); - } - return path; -} - fn to_fenced_codeblock(path: &Path, content: Rope) -> SharedString { let path_extension = path.extension().and_then(|ext| ext.to_str()); let path_string = path.to_string_lossy();