nvim-tree.lua icon indicating copy to clipboard operation
nvim-tree.lua copied to clipboard

Node Privacy

Open alex-courtis opened this issue 1 year ago • 1 comments

Nodes should not be exposed to the user. They are internal representations and should not be mutated by the user.

api.tree.get_nodes and sort_by return/are passed cloned partial nodes.

api.tree.get_node_under_cursor returns the internal node. API functions that take {node} expect a real node.

Proposal:

  1. add a node identifier like a UUID
  2. all API returns a cloned node containing UUID
  3. existing api that takes {node} maps to the internal node via identifier

1 may could achieved via absolute_path, similar to sort_by.

alex-courtis avatar Apr 18 '23 01:04 alex-courtis

This may be achieved before or during a refactor of the {node} consuming API to take {opts}.

alex-courtis avatar Apr 18 '23 01:04 alex-courtis