Skip to content

Ability to expand all collapsed code in PR diffs #2151

Closed

Description

@waldyrious

Issuehunt badges

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 Summary

tiramisu77 tiramisu77 has been rewarded.

Backers (Total: $60.00)

Submitted pull Requests


Tips


IssueHunt has been backed by the following sponsors. Become a sponsor

Activity

  1. added
    💵 Funded on Issuehunt
    on Jun 24, 2019
  2. issuehunt-oss commented on Jun 24, 2019

    @issuehunt-oss

    @issuehunt has funded $50.00 to this issue.


  3. fregante commented on Jul 1, 2019

    @fregante
    Member

    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

  4. qti3e commented on Jul 9, 2019

    @qti3e

    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.

  5. maricn commented on Jul 23, 2019

    @maricn

    +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

  6. fregante commented on Jul 23, 2019

    @fregante
    Member

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

    It doesn't look like it:

  7. maricn commented on Jul 23, 2019

    @maricn

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

  8. issuehunt-oss commented on Aug 21, 2019

    @issuehunt-oss

    @AdrianTP has funded $10.00 to this issue.


  9. AdrianTP commented on Sep 19, 2019

    @AdrianTP

    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!

  10. issuehunt-oss commented on Sep 28, 2019

    @issuehunt-oss

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

    • 💰 Total deposit: $60.00
    • 🎉 Repository reward(0%): $0.00
    • 🔧 Service fee(10%): $6.00
  11. added and removed
    💵 Funded on Issuehunt
    on Sep 28, 2019
  12. asbjornsabo commented on Mar 23, 2020

    @asbjornsabo

    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?

  13. fregante commented on Mar 24, 2020

    @fregante
    Member

    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

  14. asbjornsabo commented on Mar 24, 2020

    @asbjornsabo

    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.

  15. antoniorosario commented on Apr 7, 2020

    @antoniorosario

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

    Really would like to use this tool!

  16. kgemmert-r7 commented on Jul 9, 2020

    @kgemmert-r7

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

  17. fregante commented on Jul 9, 2020

    @fregante
    Member

    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:

    Screen Shot 2020-07-10 at 00 39 25

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

  18. asbjornsabo commented on Jul 21, 2020

    @asbjornsabo

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

  19. locked and limited conversation to collaborators on Jul 25, 2020
  20. fregante commented on Aug 7, 2020

    @fregante
    Member

    Linux users that can't make it work can try remapping the alt key: #3436 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions