-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Collapse/uncollapse all files in tree #4131
Collapse/uncollapse all files in tree #4131
Conversation
I could imagine
I would probably do separate ones. For toggling it wouldn't be quite clear what the exact logic would be.
Yes, in |
That sounds good to me |
9ee58f0
to
ffffe2e
Compare
ffffe2e
to
a9ec232
Compare
@jesseduffield @stefanhaller This pr is ready as well with localization and an integration test. I noticed there is a plan to add generics to generalize the logic between commit files and the files view but it does not look trivial. I can give it a shot in a separate pr although I might have some questions. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just one comment, otherwise LGTM. Tested it out and it works great
pkg/i18n/english.go
Outdated
@@ -1258,6 +1262,10 @@ func EnglishTranslationSet() *TranslationSet { | |||
NoBranchOnRemote: `This branch doesn't exist on remote. You need to push it to remote first.`, | |||
Fetch: `Fetch`, | |||
FetchTooltip: "Fetch changes from remote.", | |||
CollapseAll: "Collapse all files", | |||
CollapseAllTooltip: "Collapse all entries in the files tree", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CollapseAllTooltip: "Collapse all entries in the files tree", | |
CollapseAllTooltip: "Collapse all directories in the files tree", |
Likewise with below
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in d5374ac.
That would be great! Happy to answer any questions you have |
I tested this and it works nicely, but what I'm missing is to keep the selection (if possible). This won't always be possible, e.g. when collapsing it will only be possible if a top-level entry is selected, and I'd be ok with the selection jumping to an arbitrary top-level entry when that's not the case (although it would be nice if it would jump to the top-level entry which is a parent of what's currently selected; this doesn't seem super important though). When expanding, however, it should always be possible, and it's a bit annoying that it isn't right now. |
Ok, I had a bit of a closer look at the code and found a few more things that can be improved. I pushed two commits, please see their commit messages for details. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those changes look good to me @stefanhaller
5cda0ae
to
b04d1f5
Compare
I added one more commit (b04d1f5) that renames some UncollapseAll methods to ExpandAll, since that seems to be the terminology we're using for this. I'm gonna squash this now, this is ready to merge from my side. |
Co-authored-by: Stefan Haller <[email protected]>
b04d1f5
to
7bea415
Compare
Seems like this feature is highly requested #4095 #3554
Ability to collpase/expand all files in the tree both for working files and commit view files. One issue I noticed is that currently any functionality that we want to add related to the file tree has to be duplicated across both controllers/models. I would like to try to unite the functionality using generics but I would prefer if it was done as part of a separate PR as it will greatly increase the scope of this PR and doesn't look trivial. Any feedback is welcome, thanks!
Example of functionality working: