From 59736b14596a33c3bfee97755e01b381a9161e9e Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Mon, 22 Dec 2025 15:41:42 -0800 Subject: [PATCH] Allow full paths for cursor excerpt --- .../edit_prediction_cli/src/load_project.rs | 30 +++++++------------ 1 file changed, 11 insertions(+), 19 deletions(-) diff --git a/crates/edit_prediction_cli/src/load_project.rs b/crates/edit_prediction_cli/src/load_project.rs index 70daf00b79486fd917556cffaa26b1fd01ed4d28..29b2ba351771fba4a346d47208a760d027d8ead5 100644 --- a/crates/edit_prediction_cli/src/load_project.rs +++ b/crates/edit_prediction_cli/src/load_project.rs @@ -86,26 +86,18 @@ async fn cursor_position( return Err(error); } - let worktree = project.read_with(cx, |project, cx| { - project - .visible_worktrees(cx) - .next() - .context("No visible worktrees") - })??; - - let cursor_path = RelPath::new(&example.spec.cursor_path, PathStyle::Posix) - .context("Failed to create RelPath")? - .into_arc(); - let cursor_buffer = project - .update(cx, |project, cx| { - project.open_buffer( - ProjectPath { - worktree_id: worktree.read(cx).id(), - path: cursor_path, - }, - cx, - ) + let cursor_path = project + .read_with(cx, |project, cx| { + project.find_project_path(&example.spec.cursor_path, cx) })? + .with_context(|| { + format!( + "failed to find cursor path {}", + example.spec.cursor_path.display() + ) + })?; + let cursor_buffer = project + .update(cx, |project, cx| project.open_buffer(cursor_path, cx))? .await?; let cursor_offset_within_excerpt = example .spec