sindresorhus/refined-github

Ability to expand all collapsed code in PR diffs #2151

waldyrious posted onGitHub

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:

screenshot


@issuehunt has funded $50.00 to this issue.


posted by issuehunt-app[bot] almost 6 years ago

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

posted by fregante almost 6 years ago

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.

posted by qti3e over 5 years ago

+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 unfold tag. Thank you for the future implementation <3

posted by maricn over 5 years ago

I believe this is called unfold rather than expand in GH terms

It doesn't look like it:

<img width="341" alt="" src="https://user-images.githubusercontent.com/1402241/61703540-f67cf100-ad6b-11e9-8698-2294e1e6043d.png">

posted by fregante over 5 years ago

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 :)

posted by maricn over 5 years ago

@adriantp has funded $10.00 to this issue.


posted by issuehunt-app[bot] over 5 years ago

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!

posted by AdrianTP over 5 years ago

@sindresorhus has rewarded $54.00 to @tiramisu77. See it on IssueHunt

  • :moneybag: Total deposit: $60.00
  • :tada: Repository reward(0%): $0.00
  • :wrench: Service fee(10%): $6.00
posted by issuehunt-app[bot] over 5 years ago

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?

posted by asbjornsabo about 5 years ago

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

posted by fregante about 5 years ago

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.

posted by asbjornsabo about 5 years ago

Not working for me either on macOS (trying option + click).

Really would like to use this tool!

posted by antoniorosario almost 5 years ago

me too! this is a big thing for me that is missing when viewing PR' but cannot get this to work on mac OS :(

posted by kgemmert-r7 over 4 years ago

I'm on Firefox/macOS and can always make it work.

  1. Visit https://github.com/sindresorhus/refined-github/pull/2434/files
  2. Hold alt and click here:

    <img width="520" alt="Screen Shot 2020-07-10 at 00 39 25" src="https://user-images.githubusercontent.com/1402241/87097576-d036b680-c245-11ea-9215-c10f38e917df.png">

Click exclusively on the blue area in that screenshot, not on the whole line, even if it highlights.

posted by fregante over 4 years ago

@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.

posted by asbjornsabo over 4 years ago
posted by fregante over 4 years ago

Linux users that can't make it work can try remapping the alt key: https://github.com/sindresorhus/refined-github/issues/3436#issuecomment-670446085

posted by fregante over 4 years ago

Fund this Issue

$60.00
Rewarded

Rewarded pull request

Recent activities

tiramisu77 was rewarded by sindresorhus for sindresorhus/refined-github# 2151
over 5 years ago