File tree Expand file tree Collapse file tree 3 files changed +21
-17
lines changed Expand file tree Collapse file tree 3 files changed +21
-17
lines changed Original file line number Diff line number Diff line change @@ -37,4 +37,9 @@ function Class:as(class)
37
37
return self :is (class ) and self or nil
38
38
end
39
39
40
+ -- avoid unused param warnings in abstract methods
41
+ --- @param ... any
42
+ function Class :nop (...)
43
+ end
44
+
40
45
return Class
Original file line number Diff line number Diff line change @@ -139,6 +139,19 @@ function DirectoryNode:refresh()
139
139
end )
140
140
end
141
141
142
+ --- @param projects table
143
+ function DirectoryNode :reload_node_status (projects )
144
+ local toplevel = git .get_toplevel (self .absolute_path )
145
+ local status = projects [toplevel ] or {}
146
+ for _ , node in ipairs (self .nodes ) do
147
+ node :update_git_status (self :is_git_ignored (), status )
148
+ local dir = node :as (DirectoryNode )
149
+ if dir and # dir .nodes > 0 then
150
+ dir :reload_node_status (projects )
151
+ end
152
+ end
153
+ end
154
+
142
155
-- If node is grouped, return the last node in the group. Otherwise, return the given node.
143
156
--- @return DirectoryNode
144
157
function DirectoryNode :last_group_node ()
Original file line number Diff line number Diff line change @@ -21,32 +21,18 @@ local Node = Class:new()
21
21
function Node :destroy ()
22
22
end
23
23
24
- -- luacheck: push ignore 212
25
24
--- Update the GitStatus of the node
25
+ --- Abstract
26
26
--- @param parent_ignored boolean
27
27
--- @param status table ?
28
- function Node :update_git_status (parent_ignored , status ) --- @diagnostic disable-line : unused-local
29
- --- TODO find a way to declare abstract methods
28
+ function Node :update_git_status (parent_ignored , status )
29
+ self : nop ( parent_ignored , status )
30
30
end
31
31
32
- -- luacheck: pop
33
-
34
32
--- @return GitStatus ?
35
33
function Node :get_git_status ()
36
34
end
37
35
38
- --- @param projects table
39
- function Node :reload_node_status (projects )
40
- local toplevel = git .get_toplevel (self .absolute_path )
41
- local status = projects [toplevel ] or {}
42
- for _ , node in ipairs (self .nodes ) do
43
- node :update_git_status (self :is_git_ignored (), status )
44
- if node .nodes and # node .nodes > 0 then
45
- node :reload_node_status (projects )
46
- end
47
- end
48
- end
49
-
50
36
--- @return boolean
51
37
function Node :is_git_ignored ()
52
38
return self .git_status ~= nil and self .git_status .file == " !!"
You can’t perform that action at this time.
0 commit comments