Skip to content

Conversation

@xvzc
Copy link

@xvzc xvzc commented Dec 17, 2025

As described in the documentation, api.tree.change_root_to_node should set the tree root to the parent directory when the target node is a file.

                                    *nvim-tree-api.tree.change_root_to_node()*
tree.change_root_to_node({node})
    Change the tree's root to a folder node or the parent of a file node.

    Parameters: ~
      • {node} (Node) folder or file

Currently, calling this function on a file node does nothing. This commit adds logic to handle cases where the input node is a FileNode in the change_root_to_node function.

As described in the documentation, `api.tree.change_root_to_node` should
set the tree root to the parent directory when the target node is a file.

Currently, calling this function on a file node does nothing.
This commit adds logic to handle cases where the input node is a `FileNode`
in the `change_root_to_node` function.
@xvzc xvzc marked this pull request as ready for review December 17, 2025 07:19
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.

1 participant