nvim-tree / nvim-tree/nvim-tree.lua
add enable/disable option to api.tree.toggle functions
Nobody has claimed this yet.
- Dominant language
- Lua
- Stars
- 8.6k
- Forks
- 639
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 2
Description
Is this a question?
no.
Can this functionality be implemented utilising API?
no.
Is your feature request related to a problem? Please describe.
yes.
I wanted to have a key binding for "disable no_bookmark filter" but there was only toggle_no_bookmark_filter().
Describe the solution you'd like
toggle functions are nice but why not exposing the real on/off functions?
Describe alternatives you've considered
this is the way I'm doing it right now, which is probably fragile and can be broken in the upcoming updates since it's not using the public API
if require("nvim-tree.core").get_explorer().filters.state.no_bookmark then
api.tree.toggle_no_bookmark_filter()
end
I think having toggle_no_bookmark_filter(bool) would be perfect. pass with nil or no argument to toggle, pass true to turn on, pass false to turn off. doesn't break backwards compatibility and doesn't pollute the api much either.
this pattern is present in many parts of the plugin, which is really irritating
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 inspecting the api.tree.toggle functions and the nvim-tree.core explorer state shown in the issue, especially toggle_no_bookmark_filter(). Define the requested nil-or-no-argument toggle behavior and explicit true/false behavior, then check the related toggle functions for the same pattern. Done means the public API supports deterministic enabling and disabling without breaking existing toggle calls.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- lua
- Domain
- devtools
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100