Important: there is a naming conflict with the existing Explorer:expand method. Rename it to expand_dir_node first.
These expand operations apply to a directory therefore they should be moved into DirectoryNode:
expand_node should be a public method :expand
- Other functions above should be private methods
opts used in setup should be replaced by self.explorer.opts
Functions M.all and M.node should be moved to Explorer methods expand_all and expand_node
Explorer:expand_node should just call expand on the node - the appropriate Node method will be used.
A method expand should be added to Node, which will call expand on its parent, if it exists, replacing this logic:
|
expand_node(node:is(FileNode) and node.parent or node:as(DirectoryNode), expand_opts) |
Important: there is a naming conflict with the existing
Explorer:expandmethod. Rename it toexpand_dir_nodefirst.These expand operations apply to a directory therefore they should be moved into
DirectoryNode:expand_nodeshould be a public method:expandoptsused in setup should be replaced byself.explorer.optsFunctions
M.allandM.nodeshould be moved to Explorer methodsexpand_allandexpand_nodeExplorer:expand_nodeshould just callexpandon thenode- the appropriateNodemethod will be used.A method
expandshould be added toNode, which will callexpandon its parent, if it exists, replacing this logic:nvim-tree.lua/lua/nvim-tree/actions/tree/modifiers/expand.lua
Line 158 in 1b876db