sindresorhus/refined-github

Option to actually remove hidden files from PR files tab #4786

osdiab posted onGitHub

Description

When you hide files in github, it collapses them to a thin line. Normally this is good enough, but with some tools like Yarn Berry's Zero-Installs function, you can end up with an overwhelmingly large number of collapsed files, so that it's basically impossible to do a code review. I'd like the option to just completely make them go away.

Screenshot

<img width="1209" alt="Screen Shot 2021-09-15 at 16 20 16" src="https://user-images.githubusercontent.com/1890926/133525568-4ff8328c-c5ce-4821-95fa-02019baa8544.png">

Example URL

https://github.com/spinachhr/web-app/pull/213/files?file-filters%5B%5D=dotfile


This is sort of another variation of https://github.com/sindresorhus/refined-github/pull/1085 or one of the issues that were linked to it.

But actually I'm surprised that the file filter does not hide the files, 🤔 I just don't know whether we can detect whether a file is toggled by the user or hidden by the filter.

posted by fregante over 3 years ago

Maybe hide folded files with "BIN" label, like the ones on the screenshot?

posted by kidonng over 3 years ago

That's an arbitrary change. Binaries are still part of the diff

posted by fregante over 3 years ago

yeah, my problem isn't having binaries in the diff - my problem is that the default layout takes up too much space + the sheer number of dom nodes in this kind of scenario causes my computer to lag up. I can probably just make a user script that does this in my browser, but since anyone using Yarn with Zero-Installs on Github would probably run into this issue it seems like something that would be broadly useful.

posted by osdiab over 3 years ago

Actually for I have think the native filter is enough for Yarn's case, just deselect .zip.

Oh well I didn't notice it's already unchecked. My memory sucks 😅

Maybe we should listen to the filters and when an extension is unchecked, we hide the files completely.

posted by kidonng over 3 years ago

The example URL is a private repository, may as well use something else like: https://github.com/avevlad/ts-data-analysis-with-zero-install/commit/7a75e8f6f7c97ce30c29450fe076590ff999fae0

EDIT: I just realized this is for regular commits instead of PR, which brings us another question: should this feature be added, where will it run? PR page and/or commit page? If latter we will need a trigger else than the filter.

posted by kidonng over 3 years ago

yep that's it - it can just be arbitrarily large depending on what you've installed/uninstalled - in teh case in my screenshot it was a crazy number of zips lol

EDIT: actually the scenario i really care about is not the commit page but rather the Files tab of a pull request, so that URL isn't quite it for me - but it's related

posted by osdiab over 3 years ago

BTW not sure but this might be somewhat complex to do since large diffs do cause files to be lazy loaded, not sure what github's behavior is in those cases

posted by osdiab over 3 years ago

We can probably do this: completely hide files if filtered, by default.

The issue is probably that we have to manually apply the filters (i.e. select all "zip" filers, for example) because I assume GitHub does not expose "this file was toggled because of a filter" in the DOM; for us every filtered file is likely indistinguishable from a file that the user just toggled by clicking its toggle.

This might not be an easy feature and thus probably not worth it.

posted by fregante over 3 years ago
posted by FloEdelmann over 3 years ago

Excellent!

posted by fregante over 3 years ago

Fund this Issue

$0.00
Funded

Pull requests