feature: Side by Side diffs in gh snack
Did you check the docs?
- [x] I have read all the snacks.nvim docs
Is your feature request related to a problem? Please describe.
I really prefer to review diffs side by side like you can see on github, diffview.nvim, or the many other ways to do so in neovim. I find it a bit frustrating that the code review experience in gh cannot be configured with a similar experience.
I understand if the answer to this is "this wont be implemented because the unified single buffer is what everything is built around".
Describe the solution you'd like
Just like how you can select "open PR in buffer", I would like to be able to select "View Diff in Buffer"
This would open up something like a 3 split view:
Left: Snacks Explorer for the files in the diff Middle: the previous state of the file Right: the current state of the file
in which any of those could be toggled to be hidden if you want more screen real estate for the review.
And then all the gh commands of course would still work for commenting so on and so forth.
Note that the other feature I requested would also likely be substantially simpler to implement alongside this change: https://github.com/folke/snacks.nvim/issues/2476. This is because it would become much easier to open the snacks scratch comment buffer in a way that does not hide the content you are commenting on.
Describe alternatives you've considered
Currently, I am just considering getting used to reviewing in a single buffer. I have not liked the experience of any of the other plugins (e.g. octo) to do review, and I really like this one. And I don't see any feasible option today for diff from snacks to support a side by side view.
Additional context
No response
One neat thing about having a full diff of two file states is that it's easier to select code to be commented on. In the gitlab.nvim plugin (which uses diffview.nvim for showing diffs), we've even created operator mappings that can be used like this: cip created a "comment for inner paragraph", just like builtin cip "changes inner paragraph" (works of course for any motion or text object). It makes commenting on code so much smoother than going to visual mode, using jk to select lines, pressing a "comment" key.
Another benefit of reviewing a PR on actual code in a repo is that LSP diagnostics are available to the reviewer which is not the case with a custom diff just for the changed code.
Hi I think its really usefully specifically when we are reviewing the long PR
Another benefit of reviewing a PR on actual code in a repo is that LSP diagnostics are available to the reviewer which is not the case with a custom diff just for the changed code.
Yeah, my only git workflow not fully replaced by this is the following:
- open picker with PRs
- on select, fetch + checkout (ask for stash permission if required)
- open diffview
Since you need to be on the actual branch if you want to show diagnostics, and the ability to jump around the code and come back to the review buffer trivially is awesome.
For now, I may just try and make the above as an action in snacks.gh, but not sure how i will allow commenting
Another benefit of reviewing a PR on actual code in a repo is that LSP diagnostics are available to the reviewer which is not the case with a custom diff just for the changed code.
Yeah, my only git workflow not fully replaced by this is the following:
- open picker with PRs
- on select, fetch + checkout (ask for stash permission if required)
- open diffview
Since you need to be on the actual branch if you want to show diagnostics, and the ability to jump around the code and come back to the review buffer trivially is awesome.
For now, I may just try and make the above as an action in snacks.gh, but not sure how i will allow commenting
For context, in case anybody is curious about integrating the above with this snacks as an action, you can see this part of my dotfiles:
https://github.com/RyanSaxe/dotfiles/blob/52cf84b4f84050cb0ed844c0da257aa14125bcf2/nvim/lua/custom/snacks/gh.lua
Since, at least the way this module is written currently, you can inject custom actions. So the above simply will fetch the correct refs and open diffview for them.
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.
Commenting to bump this so it is not stale, as it's a real feature request that multiple others seem interested