-
Notifications
You must be signed in to change notification settings - Fork 255
feat: New node-scanning algorithm and empty folder states #600
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
Conversation
Yes! I intended for it to work this way originally, but it was problematic so I called it good enough to do one level at a time.
It should be the default, only if the user chooses to group empty directories.
It is only used by the
|
Ok, then I suggest to do the following: Some ui tests fail, because the requirements changed with the new functionality added. As we decided to go with the new approach I would need to adapt those tests accordingly. If you give me the "GO" for these suggestions to be implemented, I'll get it done :-) |
I've learned the hard way that there are always some users out there that have projects that are so different from mine that there will be a large performance impact to them from everything extra I do. We really do need to make this an opt in feature. Even if I did intend for it to be default, I would still provide an option for people to go back to the old behavior just in case. This is a very delicate area. Also, if the I just noticed that you went back to using plenary's scandir functions, I actually switched off of them for good reasons and I would not want to go back to using them. Basically, they are slower and the hidden files/gitignored logic is wrong. |
Ok, then I will make everything newly added "opt-in".
Yes I think when using my algorithm it recursively visits the entire tree and it is laggy doing it initially on a large project.
Oh boy. I just added this because I saw it being used somewhere in the codebase already and hence thought this was ok to use. So I should only use the built-in uv I/O functions then? Is it ok to use plenarys async module to avoid callback hell? |
Plenary in general is a good library and especially the async module is very useful, I just don't like the |
c36263d
to
9944539
Compare
@cseickel hey, I implemented the changes. Let me know what you think. If you have better name suggestions, I am more than happy to hear them :-) |
Hey @zenoli, I know this is annoying but I just merged another PR that affects the directory scanning and causes conflicts with yours: #618 The reason I put that new one first is because it was really a bug, it's relatively simple, and it impacts most of the user base. Hopefully it's not too much trouble for you to incorporate those fixes. I scanned your code and this is my understanding, correct me if I am wrong: If the option is on, it will always recurse 1 extra level, but then will stop and throw away the results if the next level is not an empty folder. Is that accurate? |
Hey @cseickel I just saw the conflicts, but I don't think it will be much of an effort to incorporate them, no worries.
Maybe let me explain it in an example just to be concrete:
Initially However, what I try to achieve is to have more information after expanding a directory. I also want to know which if the children are empty, full, or containing a chain of single directories (to display them all on one line if
I hope this makes things clearer. |
815bda0
to
3faa07c
Compare
Yes, that sounds perfect. Thanks for the walkthrough. |
Hi @cseickel, |
I was actually waiting for you to rebase and fix the merge conflicts in |
3faa07c
to
9ef026e
Compare
9ef026e
to
0d40d82
Compare
@cseickel I used to rebase a while ago, but since then new conflicts arose which I didn't notice :-) |
Thanks @zenoli, I'll take look at this tonight. I promise I'll merge or reply to this before merging any other changes. |
Perfect! In case you have time, maybe also look at #522 which is already rebased on top of this branch. |
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.
Looks good!
This PR implements open/closed states for empty folders which is required in order to complete my other PR.
This involved actively checking wheter newly revealed folder nodes are empty and if so, showing the "empty folder" icon directly. This led me to the idea to also check if the folder contains only a single child directory. By applying this check recursively, and scanning down the chain such directories, neo-tree will directly display all grouped directories if "group_empty_directories" is set. This recursive scanning will not recursively explode and scan exponentially many nodes, as it only scans what really needs to be shown in the tree. (See the GIF below).
This PR is still a WIP and before I proceed I would like to get some feedback on the following points:
sync_scan
andasync_scan
infs_scan.lua
. Would you want to make this the default behaviour or should it be opt-in setting a new config option (for example "prescan_empty_folders")?sync_scan
andasync_scan
there is the possibility to scan recusively based on what is set incontext-recursive
. From what I could tell, recusive option only behaved correctly in sync version (and of course blocked neovim if opening neo-tree in large projects.) Is this code path actively used? If yes and in case my implementation would become the default, I would have to add this recursive behaviour to the new implementation as well.Best,
Zenoli