From 20675fbb05421b45e67d8bccf4f1a9e15d67db7e Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Mon, 22 Dec 2025 15:28:24 -0800 Subject: [PATCH] Allow full path for cursor path --- crates/edit_prediction/src/udiff.rs | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/crates/edit_prediction/src/udiff.rs b/crates/edit_prediction/src/udiff.rs index 78fec03dd78301d56ac6e3f914ba60432e41637d..81efa08919ad345b00d7bbccb8bc9487f65c7577 100644 --- a/crates/edit_prediction/src/udiff.rs +++ b/crates/edit_prediction/src/udiff.rs @@ -15,9 +15,7 @@ use collections::HashMap; use gpui::AsyncApp; use gpui::Entity; use language::{Anchor, Buffer, OffsetRangeExt as _, TextBufferSnapshot}; -use project::{Project, ProjectPath}; -use util::paths::PathStyle; -use util::rel_path::RelPath; +use project::Project; #[derive(Clone, Debug)] pub struct OpenedBuffers(#[allow(unused)] HashMap>); @@ -30,27 +28,15 @@ pub async fn apply_diff( ) -> Result { let mut included_files = HashMap::default(); - let worktree_id = project.read_with(cx, |project, cx| { - anyhow::Ok( - project - .visible_worktrees(cx) - .next() - .context("no worktrees")? - .read(cx) - .id(), - ) - })??; - for line in diff_str.lines() { let diff_line = DiffLine::parse(line); if let DiffLine::OldPath { path } = diff_line { let buffer = project .update(cx, |project, cx| { - let project_path = ProjectPath { - worktree_id, - path: RelPath::new(Path::new(path.as_ref()), PathStyle::Posix)?.into_arc(), - }; + let project_path = project + .find_project_path(path.as_ref(), cx) + .context("no such path")?; anyhow::Ok(project.open_buffer(project_path, cx)) })?? .await?;