nvim-tree / nvim-tree/nvim-tree.lua
Cache FileNode Icon And Highlight
Nobody has claimed this yet.
- Dominant language
- Lua
- Stars
- 8.6k
- Forks
- 639
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 2
Description
HighlightedString for :highlighted_icon :highlighted_name should not change unless:
- options change
- name changes
Options:
- Cache these in the Node (preferred)
- add a cache around
get_icon(will grow large, avoid)
1 is achievable for files as:
- It doesn't appear that name is set anywhere, hence safe to calculate once during construction.
- Executable is set once on construction/reload
- Explorer will be destroyed on config change, clearing cached values
1 is not achievable for directories as the icon changes based on whether the directory is open or grouped.
Plan:
- Add private members to
FileNodethat stores thenvim_tree.api.HighlightedStringhl_iconhl_name
FileNodeandFileLinkNodepopulate members in the constructor, moving logic from::highlighted_icon:highlighted_name
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the FileNode and FileLinkNode constructors and the highlighted_icon and highlighted_name implementations. Trace how highlighted values are currently produced for files and directories, then verify the intended cache lifetime against option changes, name changes, executable reloads, and directory state. Done means file values are reused while directory highlighting remains dynamic.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- lua
- Domain
- performance
- Issue type
- Refactor
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100