ep: Diagnostics as `retrieval_chunks` for sweep ep (#47441)

versecafe created

Release Notes:

- N/A

Change summary

crates/edit_prediction/src/sweep_ai.rs | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)

Detailed changes

crates/edit_prediction/src/sweep_ai.rs 🔗

@@ -95,7 +95,7 @@ impl SweepAi {
                 write_event(event.as_ref(), &mut recent_changes).unwrap();
             }
 
-            let mut file_chunks = recent_buffer_snapshots
+            let file_chunks = recent_buffer_snapshots
                 .into_iter()
                 .map(|snapshot| {
                     let end_point = Point::new(30, 0).min(snapshot.max_point());
@@ -120,7 +120,7 @@ impl SweepAi {
                 })
                 .collect::<Vec<_>>();
 
-            let retrieval_chunks = inputs
+            let mut retrieval_chunks: Vec<FileChunk> = inputs
                 .related_files
                 .iter()
                 .flat_map(|related_file| {
@@ -155,17 +155,19 @@ impl SweepAi {
 
                 writeln!(
                     &mut diagnostic_content,
-                    "{} at line {}: {}",
-                    severity,
+                    "{}:{}:{}: {}: {}",
+                    full_path.display(),
                     start_point.row + 1,
+                    start_point.column + 1,
+                    severity,
                     entry.diagnostic.message
                 )?;
             }
 
             if !diagnostic_content.is_empty() {
-                file_chunks.push(FileChunk {
-                    file_path: format!("Diagnostics for {}", full_path.display()),
-                    start_line: 0,
+                retrieval_chunks.push(FileChunk {
+                    file_path: "diagnostics".to_string(),
+                    start_line: 1,
                     end_line: diagnostic_count,
                     content: diagnostic_content,
                     timestamp: None,