zed icon indicating copy to clipboard operation
zed copied to clipboard

Allow to toggle git hunk diffs

Open SomeoneToIgnore opened this issue 1 year ago • 0 comments

Part of https://github.com/zed-industries/zed/issues/4523

Added two new actions with the default keybindings

"cmd-'": "editor::ToggleGitHunkDiff",
"cmd-\"": "editor::ExpandAllGitHunkDiffs",

that allow to browse git hunks in Zed:

https://github.com/zed-industries/zed/assets/2690773/9a8a7d10-ed06-4960-b4ee-fe28fc5c4768

The hunks are dynamic and alter on user modifications, or toggle hidden, if the modification was not adjacent and also get hidden on fold.

Release Notes:

  • Added editor::ToggleGitHunkDiff (cmd-') and editor::ExpandAllGitHunkDiffs (cmd-\") actions to browse git hunk diffs in Zed

TODO:

  • [ ] more tests, mentioned in TODO kb comments
  • [ ] performance improvements. The main one would be to consider parsing git diff base into a buffer and use its excerpts in a multibuffer editor block
  • [ ] whole hunk diff toggling should become async and debounce on edits
  • [ ] ideally, we need to add a revert button into each expanded hunk
  • [ ] bug fixes

SomeoneToIgnore avatar Apr 26 '24 23:04 SomeoneToIgnore