Skip to content

Conversation

@Uanela
Copy link
Collaborator

@Uanela Uanela commented Dec 28, 2025

Description

Refactors the expand functionality by moving it from the actions layer into node methods, improving encapsulation and making the code more object-oriented.

Changes

  • Removed lua/nvim-tree/actions/tree/modifiers/expand.lua module
  • Moved expansion logic into DirectoryNode and Explorer classes as methods
  • Added DirectoryNode:expand() - public method for recursive directory expansion
  • Added DirectoryNode:expand_dir_node() - helper to open and load a single directory
  • Added Node:expand() - dispatcher that handles both file and directory nodes
  • Added Explorer:expand_all() and Explorer:expand_node() - wrapper methods for the API
  • Updated API endpoints to use new Explorer methods via wrap_explorer
  • Replaced core.get_explorer() calls with self.explorer references
  • Renamed Explorer:expand() to Explorer:expand_dir_node() to avoid naming conflicts
  • Removed modifiers.setup() as it's no longer needed

Benefits

  • Better encapsulation: expansion behavior lives with the node data structures
  • Reduced coupling between actions and core modules
  • More intuitive API: nodes know how to expand themselves
  • Easier to maintain and extend

Related Issues

Closes #2255

Move expansion logic from actions/tree/modifiers/expand.lua into
DirectoryNode and Explorer methods. Update API to use new methods
via wrap_explorer. Remove expand module and its setup calls.
@Uanela Uanela requested a review from alex-courtis December 28, 2025 17:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Multi Instance - Contributors Wanted - Please Take An Issue

1 participant