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
|
@ -89,6 +89,9 @@ struct Args {
|
|||
/// Will attempt to give the correct command to run
|
||||
#[arg(long)]
|
||||
system_specs: bool,
|
||||
/// Pairs of file paths to diff. Can be specified multiple times.
|
||||
#[arg(long, action = clap::ArgAction::Append, num_args = 2, value_names = ["OLD_PATH", "NEW_PATH"])]
|
||||
diff: Vec<String>,
|
||||
/// Uninstall Zed from user system
|
||||
#[cfg(all(
|
||||
any(target_os = "linux", target_os = "macos"),
|
||||
|
@ -232,9 +235,17 @@ fn main() -> Result<()> {
|
|||
let exit_status = Arc::new(Mutex::new(None));
|
||||
let mut paths = vec![];
|
||||
let mut urls = vec![];
|
||||
let mut diff_paths = vec![];
|
||||
let mut stdin_tmp_file: Option<fs::File> = None;
|
||||
let mut anonymous_fd_tmp_files = vec![];
|
||||
|
||||
for path in args.diff.chunks(2) {
|
||||
diff_paths.push([
|
||||
parse_path_with_position(&path[0])?,
|
||||
parse_path_with_position(&path[1])?,
|
||||
]);
|
||||
}
|
||||
|
||||
for path in args.paths_with_position.iter() {
|
||||
if path.starts_with("zed://")
|
||||
|| path.starts_with("http://")
|
||||
|
@ -273,6 +284,7 @@ fn main() -> Result<()> {
|
|||
tx.send(CliRequest::Open {
|
||||
paths,
|
||||
urls,
|
||||
diff_paths,
|
||||
wait: args.wait,
|
||||
open_new_workspace,
|
||||
env,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue