@@ -8,7 +8,7 @@ local Class = require("nvim-tree.class")
88
99--- Abstract Node class.
1010--- Uses the abstract factory pattern to instantiate child instances.
11- --- @class (exact ) BaseNode : Class
11+ --- @class (exact ) Node : Class
1212--- @field type NODE_TYPE
1313--- @field explorer Explorer
1414--- @field absolute_path string
@@ -21,11 +21,9 @@ local Class = require("nvim-tree.class")
2121--- @field watcher Watcher ?
2222--- @field diag_status DiagStatus ?
2323--- @field is_dot boolean cached is_dotfile
24- local BaseNode = Class :new ()
24+ local Node = Class :new ()
2525
26- --- @alias Node RootNode | BaseNode | DirectoryNode | FileNode | DirectoryLinkNode | FileLinkNode
27-
28- function BaseNode :destroy ()
26+ function Node :destroy ()
2927 if self .watcher then
3028 self .watcher :destroy ()
3129 self .watcher = nil
3634--- Update the GitStatus of the node
3735--- @param parent_ignored boolean
3836--- @param status table ?
39- function BaseNode :update_git_status (parent_ignored , status ) --- @diagnostic disable-line : unused-local
37+ function Node :update_git_status (parent_ignored , status ) --- @diagnostic disable-line : unused-local
4038end
4139
4240-- luacheck: pop
4341
4442--- @return GitStatus ?
45- function BaseNode :get_git_status ()
43+ function Node :get_git_status ()
4644end
4745
4846--- @param projects table
49- function BaseNode :reload_node_status (projects )
47+ function Node :reload_node_status (projects )
5048 local toplevel = git .get_toplevel (self .absolute_path )
5149 local status = projects [toplevel ] or {}
5250 for _ , node in ipairs (self .nodes ) do
@@ -58,13 +56,13 @@ function BaseNode:reload_node_status(projects)
5856end
5957
6058--- @return boolean
61- function BaseNode :is_git_ignored ()
59+ function Node :is_git_ignored ()
6260 return self .git_status ~= nil and self .git_status .file == " !!"
6361end
6462
6563--- Node or one of its parents begins with a dot
6664--- @return boolean
67- function BaseNode :is_dotfile ()
65+ function Node :is_dotfile ()
6866 if
6967 self .is_dot
7068 or (self .name and (self .name :sub (1 , 1 ) == " ." ))
7977--- Return self, should only be called on a DirectoryNode
8078--- TODO #2886 remove method or leave in place, warn if practical and non too intrusive
8179--- @return Node
82- function BaseNode :last_group_node ()
83- error (string.format (" \n BaseNode :last_group_node called for '%s'" , self .absolute_path ))
80+ function Node :last_group_node ()
81+ error (string.format (" \n Node :last_group_node called for '%s'" , self .absolute_path ))
8482 return self
8583end
8684
8785--- @param project table ?
8886--- @param root string ?
89- function BaseNode :update_parent_statuses (project , root )
87+ function Node :update_parent_statuses (project , root )
9088 local node = self
9189 while project and node do
9290 -- step up to the containing project
118116
119117--- Get the highest parent of grouped nodes, nil when not grouped
120118--- @return DirectoryNode ?
121- function BaseNode :get_parent_of_group ()
119+ function Node :get_parent_of_group ()
122120 if not self .parent or not self .parent .group_next then
123121 return nil
124122 end
@@ -134,12 +132,12 @@ function BaseNode:get_parent_of_group()
134132end
135133
136134--- Create a sanitized partial copy of a node, populating children recursively.
137- --- @return BaseNode cloned
138- function BaseNode :clone ()
135+ --- @return Node cloned
136+ function Node :clone ()
139137 --- @type Explorer
140138 local explorer_placeholder = nil
141139
142- --- @type BaseNode
140+ --- @type Node
143141 local clone = {
144142 type = self .type ,
145143 explorer = explorer_placeholder ,
@@ -158,4 +156,4 @@ function BaseNode:clone()
158156 return clone
159157end
160158
161- return BaseNode
159+ return Node
0 commit comments