You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Ability to expand all collapsed code in PR diffs #2151
When reviewing PRs, sometimes it's useful to view the entire file with the diffs in context. To do this, one needs to click the expand diff button multiple times until the entire file is exposed.
I'd like to be able to alt-click one of the expand markers in collapsed code and have all code blocks expand at once (perhaps limited to the current file). A similar feature was recently added to VSCode, btw, so there's precedence for this.
There is already a feature to view the file at the commit associated to the diff being viewed, but then the full code is shown unmarked, without the diff indicating what changed.
Also, please note that this is about expanding/collapsing code within a diff, rather than folding entire files, which was a previous feature and was removed after it was implemented directly by GitHub (see #1486). What I'm talking about is this:
Need some help from other developers? Add your repositories on IssueHunt to raise funds.
IssueHunt has been backed by the following sponsors. Become a sponsor
Reacted by Sindre Sorhus, BlueFyre, Adrian Thomas-Prestemon, troshko111, Sonia Hamilton, Luke Childs, tpilewicz, Allison Graham, Jon Schneider, Steve C and 9 more
Easiest solution: click all "expand" buttons until there are no more left, but this will cause multiple sequential loads and will look messy.
Ideal solution: load file from its "View file" link and then merge it with the current dom. This is probably a bit hard, especially on the split diff view.
You can also clone the DOM node and replace it with the original one, then click on expand (from the original DOM tree) until there is no more left, and then put it back and remove the fake DOM node.
Thanks, @Tiramisu77 and @fregante! I just updated my extension to 19.9.19 and gave it a little test. It is indeed a little slow, as you noted in the PR comments, but considering that all you have to work with is UI elements, it works perfectly. Just alt-click one of the "expand" gutter buttons and all of the folded lines unfurl within a couple of seconds (depending on the size of the file and how many folded sections exist, obviously). Wonderful!
This seems to be just the thing I have been looking for. But how does one use it?
(I tried to Alt-click on the "expand" buttons at the side of the file, but it only expands as it would if I had clicked the button normally - no "expand all" to be seen.
Can someone please explain?
And what you do is "Alt-Click" on this symbol? (That is, clicking when holding the Alt button?)
Does not work for me. Tested with Firefox and Chromium under Linux, and with Firefox (I believe) under Windows 10.
Would really like to have this working.
I hold alt, and click in that blue box with the up-arrow and dots, and I get 20 more lines unfolding. Not all lines.
Firefox 68.10.0esr (64bit) on Windows 10.
Activity
issuehunt-oss commentedon Jun 24, 2019
@issuehunt has funded $50.00 to this issue.
fregante commentedon Jul 1, 2019
Easiest solution: click all "expand" buttons until there are no more left, but this will cause multiple sequential loads and will look messy.
Ideal solution: load file from its "View file" link and then merge it with the current dom. This is probably a bit hard, especially on the split diff view.
Other solutions welcome
qti3e commentedon Jul 9, 2019
You can also clone the DOM node and replace it with the original one, then click on
expand(from the original DOM tree) until there is no more left, and then put it back and remove the fake DOM node.maricn commentedon Jul 23, 2019
+1
I believe this is called unfold rather than expand in GH terms, because expand means expand/collapse of a file.
Just wanted to add a comment to make the issue searchable with
unfoldtag. Thank you for the future implementation <3fregante commentedon Jul 23, 2019
It doesn't look like it:
maricn commentedon Jul 23, 2019
True, anyways, in their original blog post it was called unfold.. https://github.blog/2013-12-02-expanding-context-in-diffs/
Anyways, looking forward to seeing this feature :)
issuehunt-oss commentedon Aug 21, 2019
@AdrianTP has funded $10.00 to this issue.
AdrianTP commentedon Sep 19, 2019
Thanks, @Tiramisu77 and @fregante! I just updated my extension to 19.9.19 and gave it a little test. It is indeed a little slow, as you noted in the PR comments, but considering that all you have to work with is UI elements, it works perfectly. Just alt-click one of the "expand" gutter buttons and all of the folded lines unfurl within a couple of seconds (depending on the size of the file and how many folded sections exist, obviously). Wonderful!
issuehunt-oss commentedon Sep 28, 2019
@sindresorhus has rewarded $54.00 to @Tiramisu77. See it on IssueHunt
asbjornsabo commentedon Mar 23, 2020
This seems to be just the thing I have been looking for. But how does one use it?
(I tried to Alt-click on the "expand" buttons at the side of the file, but it only expands as it would if I had clicked the button normally - no "expand all" to be seen.
Can someone please explain?
fregante commentedon Mar 24, 2020
I just tried it and it still works. Here's a demo
Try refreshing the page before clicking the button, maybe that's the bug
asbjornsabo commentedon Mar 24, 2020
And what you do is "Alt-Click" on this symbol? (That is, clicking when holding the Alt button?)
Does not work for me. Tested with Firefox and Chromium under Linux, and with Firefox (I believe) under Windows 10.
Would really like to have this working.
antoniorosario commentedon Apr 7, 2020
Not working for me either on macOS (trying option + click).
Really would like to use this tool!
kgemmert-r7 commentedon Jul 9, 2020
me too! this is a big thing for me that is missing when viewing PR' but cannot get this to work on mac OS :(
fregante commentedon Jul 9, 2020
I'm on Firefox/macOS and can always make it work.
altand click here:Click exclusively on the blue area in that screenshot, not on the whole line, even if it highlights.
asbjornsabo commentedon Jul 21, 2020
@fregante
Lucky you ;-)
I hold alt, and click in that blue box with the up-arrow and dots, and I get 20 more lines unfolding. Not all lines.
Firefox 68.10.0esr (64bit) on Windows 10.
fregante commentedon Jul 25, 2020
Firefox 68 is not supported. Firefox 78 is the minimum version https://github.com/sindresorhus/refined-github/blob/f2a96713692c2227035b86a63714704d82b6f6bd/source/manifest.json#L8-L12
fregante commentedon Aug 7, 2020
Linux users that can't make it work can try remapping the alt key: #3436 (comment)