-
-
Notifications
You must be signed in to change notification settings - Fork 624
Refactor: attributes modules & line builder #1889
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
Comments
This is fantastic, thank you for taking the initiative.
attributes are the bulk of the operations and are cheap i.e. no file system operations. Isolating and extracting these will result in great performance improvements and greater readability/reasonability.
We don't need to make any decisions now. Start things off and we will see if breaking is even necessary.
Internal only for now please. Let's not publish anything until we're sure of our final state. |
I might suggest we start with a high value / low complexity one like opened. The API can evolve as we need it e.g. propagation. |
I don't think breaking is necessary. I just feel like we'd benefit from being able to make breaking changes (i.e. have some sort of versioning). I was thinking if we can have proper versioning before we finish this refactoring, we can put into the next version.
Sure thing, exposing everything to the user will be our final step.
Already working on it :) https://github.com/nvim-tree/nvim-tree.lua/tree/opened-file-feature-parity, I'm a bit busy recently so it might take me a while though. |
Love your work! |
#2415 addresses some points. |
Uh oh!
There was an error while loading. Please reload this page.
As discussed in #1871 (comment)
Background
nvim-tree is a very customizable plugin and it provide options to display certain attributes of files and directories.
Currently, 4 such attributes are implemented: git, diagnostics, modified and opened. However, they're all implemented separately, and as a result, have duplicated logic between them and lack feature parity (e.g. can only display diagnostics in signcolumn, can't see if file in a directory are opened without opening the directory).
Further more, it is more difficult that necessary to implement new attributes as there's no existing framework to allow such implementation without an understanding of how the renderer works. Many of the attributes' implementation are also tightly coupled with the rest of nvim-tree making maintenance more difficult.
Proposed solution
We split nvim-tree into three distinct part: core, attributes modules & line builder.
Git, diagnostics, modified & opened becomes attributes modules. They interact with core to attach attributes to paths (i.e. directories & files). Core can propagate attributes to parents / children at the attributes module's request.
Core calls line builder with all the path's attributes + other info like name, depth. Line builder returns everything the core needs to display including padding, signcolumn, highlights etc.
Resulting improvements
Direct improvements
Potential improvements
Decision to be made
custom_filter
.Steps
The text was updated successfully, but these errors were encountered: