Diff view (#32922)
Todo: * [x] Open diffed files as regular buffers * [x] Update diff when buffers change * [x] Show diffed filenames in the tab title * [x] Investigate why syntax highlighting isn't reliably handled for old text * [x] remove unstage/restore buttons Release Notes: - Adds `zed --diff A B` to show the diff between the two files --------- Co-authored-by: Max Brunsfeld <maxbrunsfeld@gmail.com> Co-authored-by: Ben Brandt <benjamin.j.brandt@gmail.com> Co-authored-by: Agus Zubiaga <agus@zed.dev>
This commit is contained in:
parent
2f52e2d285
commit
45b5b2e60d
14 changed files with 655 additions and 35 deletions
|
@ -2439,11 +2439,14 @@ impl Project {
|
|||
abs_path: impl AsRef<Path>,
|
||||
cx: &mut Context<Self>,
|
||||
) -> Task<Result<Entity<Buffer>>> {
|
||||
if let Some((worktree, relative_path)) = self.find_worktree(abs_path.as_ref(), cx) {
|
||||
self.open_buffer((worktree.read(cx).id(), relative_path), cx)
|
||||
} else {
|
||||
Task::ready(Err(anyhow!("no such path")))
|
||||
}
|
||||
let worktree_task = self.find_or_create_worktree(abs_path.as_ref(), false, cx);
|
||||
cx.spawn(async move |this, cx| {
|
||||
let (worktree, relative_path) = worktree_task.await?;
|
||||
this.update(cx, |this, cx| {
|
||||
this.open_buffer((worktree.read(cx).id(), relative_path), cx)
|
||||
})?
|
||||
.await
|
||||
})
|
||||
}
|
||||
|
||||
#[cfg(any(test, feature = "test-support"))]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue