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) |