Skip to content

Commit d50e783

Browse files
committed
use Node everywhere in luadoc
1 parent 121da6e commit d50e783

File tree

14 files changed

+28
-22
lines changed

14 files changed

+28
-22
lines changed

lua/nvim-tree/actions/fs/create-file.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ local function get_containing_folder(node)
3939
return node.absolute_path:sub(0, -node_name_size - 1)
4040
end
4141

42-
---@param node Node|nil
42+
---@param node Node?
4343
function M.fn(node)
4444
local cwd = core.get_cwd()
4545
if cwd == nil then

lua/nvim-tree/actions/tree/modifiers/expand-all.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,10 @@ local function gen_iterator()
6161
end
6262
end
6363

64-
---@param base_node table
65-
function M.fn(base_node)
64+
---@param node Node
65+
function M.fn(node)
6666
local explorer = core.get_explorer()
67-
local node = base_node.nodes and base_node or explorer
67+
node = node.nodes and node or explorer
6868
if gen_iterator()(node) then
6969
notify.warn("expansion iteration was halted after " .. M.MAX_FOLDER_DISCOVERY .. " discovered folders")
7070
end

lua/nvim-tree/api.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ Api.fs.copy.basename = wrap_node(wrap_explorer_member("clipboard", "copy_basenam
198198
Api.fs.copy.relative_path = wrap_node(wrap_explorer_member("clipboard", "copy_path"))
199199

200200
---@param mode string
201-
---@param node table
201+
---@param node Node
202202
local function edit(mode, node)
203203
local path = node.absolute_path
204204
if node.link_to and not node.nodes then

lua/nvim-tree/buffers.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ function M.reload_modified()
2121
end
2222
end
2323

24-
---@param node table
24+
---@param node Node
2525
---@return boolean
2626
function M.is_modified(node)
2727
return node
@@ -32,7 +32,7 @@ function M.is_modified(node)
3232
end
3333

3434
---A buffer exists for the node's absolute path
35-
---@param node table
35+
---@param node Node
3636
---@return boolean
3737
function M.is_opened(node)
3838
return node and vim.fn.bufloaded(node.absolute_path) > 0

lua/nvim-tree/explorer/init.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ function Explorer:_load(node)
228228
end
229229

230230
---@private
231-
---@param nodes_by_path table
231+
---@param nodes_by_path Node[]
232232
---@param node_ignored boolean
233233
---@param status table|nil
234234
---@return fun(node: Node): table

lua/nvim-tree/explorer/live-filter.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ function LiveFilter:new(opts, explorer)
2323
return o
2424
end
2525

26-
---@param node_ Node|nil
26+
---@param node_ Node?
2727
local function reset_filter(self, node_)
2828
node_ = node_ or self.explorer
2929

@@ -85,7 +85,7 @@ local function matches(self, node)
8585
return vim.regex(self.filter):match_str(name) ~= nil
8686
end
8787

88-
---@param node_ Node|nil
88+
---@param node_ Node?
8989
function LiveFilter:apply_filter(node_)
9090
if not self.filter or self.filter == "" then
9191
reset_filter(self, node_)

lua/nvim-tree/explorer/sorters.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ local function split_merge(t, first, last, comparator)
111111
end
112112

113113
---Perform a merge sort using sorter option.
114-
---@param t table nodes
114+
---@param t Node[]
115115
function Sorter:sort(t)
116116
if self.user then
117117
local t_user = {}

lua/nvim-tree/lib.lua

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,9 @@ function M.get_node_at_cursor()
4242
return utils.get_nodes_by_line(core.get_explorer().nodes, core.get_nodes_starting_line())[cursor[1]]
4343
end
4444

45+
---TODO move to node
4546
---Create a sanitized partial copy of a node, populating children recursively.
46-
---@param node Node|nil
47+
---@param node Node?
4748
---@return Node|nil cloned node
4849
local function clone_node(node)
4950
if not node then
@@ -83,6 +84,7 @@ function M.get_nodes()
8384
return clone_node(core.get_explorer())
8485
end
8586

87+
---TODO move to node
8688
---Group empty folders
8789
-- Recursively group nodes
8890
---@param node Node
@@ -99,6 +101,7 @@ function M.group_empty_folders(node)
99101
return node.nodes
100102
end
101103

104+
---TODO move to node
102105
---Ungroup empty folders
103106
-- If a node is grouped, ungroup it: put node.group_next to the node.nodes and set node.group_next to nil
104107
---@param node Node
@@ -111,6 +114,7 @@ function M.ungroup_empty_folders(node)
111114
end
112115
end
113116

117+
---TODO move to node
114118
---@param node Node
115119
---@return Node[]
116120
function M.get_all_nodes_in_group(node)
@@ -123,6 +127,7 @@ function M.get_all_nodes_in_group(node)
123127
return nodes
124128
end
125129

130+
---TODO move to node
126131
-- Toggle group empty folders
127132
---@param head_node Node
128133
local function toggle_group_folders(head_node)
@@ -135,6 +140,7 @@ local function toggle_group_folders(head_node)
135140
end
136141
end
137142

143+
---TODO move to node
138144
---@param node Node
139145
function M.expand_or_collapse(node, toggle_group)
140146
local explorer = core.get_explorer()

lua/nvim-tree/log.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ end
7171
--- Write to log file the inspection of a node
7272
--- defaults to the node under cursor if none is provided
7373
---@param typ string as per log.types config
74-
---@param node table|nil node to be inspected
74+
---@param node Node? node to be inspected
7575
---@param fmt string for string.format
7676
---@vararg any arguments for string.format
7777
function M.node(typ, node, fmt, ...)

lua/nvim-tree/node/init.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ local BaseNode = {}
2121

2222
---@alias Node RootNode|BaseNode|DirectoryNode|FileNode|LinkNode
2323

24-
---@param o BaseNode|nil
24+
---@param o BaseNode?
2525
---@return BaseNode
2626
function BaseNode:new(o)
2727
o = o or {}

lua/nvim-tree/renderer/builder.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ function Builder:build_symlink(node)
189189
end
190190

191191
---@private
192-
---@param node table
192+
---@param node Node
193193
---@return HighlightedString icon
194194
---@return HighlightedString name
195195
function Builder:build_file(node)

lua/nvim-tree/renderer/components/diagnostics.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ local M = {
1414
}
1515

1616
---Diagnostics highlight group and position when highlight_diagnostics.
17-
---@param node table
17+
---@param node Node
1818
---@return HL_POSITION position none when no status
1919
---@return string|nil group only when status
2020
function M.get_highlight(node)
@@ -38,7 +38,7 @@ function M.get_highlight(node)
3838
end
3939

4040
---diagnostics icon if there is a status
41-
---@param node table
41+
---@param node Node
4242
---@return HighlightedString|nil modified icon
4343
function M.get_icon(node)
4444
if node and M.config.diagnostics.enable and M.config.renderer.icons.show.diagnostics then

lua/nvim-tree/renderer/components/padding.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ end
5959
---@param depth integer
6060
---@param idx integer
6161
---@param nodes_number integer
62-
---@param node table
62+
---@param node Node
6363
---@param markers table
6464
---@return HighlightedString[]
6565
function M.get_indent_markers(depth, idx, nodes_number, node, markers, early_stop)
@@ -79,7 +79,7 @@ function M.get_indent_markers(depth, idx, nodes_number, node, markers, early_sto
7979
return { str = str, hl = { "NvimTreeIndentMarker" } }
8080
end
8181

82-
---@param node table
82+
---@param node Node
8383
---@return HighlightedString[]|nil
8484
function M.get_arrows(node)
8585
if not M.config.icons.show.folder_arrow then

lua/nvim-tree/utils.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ end
120120

121121
-- Find the line number of a node.
122122
-- Return -1 is node is nil or not found.
123-
---@param node Node|nil
123+
---@param node Node?
124124
---@return integer
125125
function M.find_node_line(node)
126126
if not node then
@@ -472,7 +472,7 @@ end
472472
---Focus node passed as parameter if visible, otherwise focus first visible parent.
473473
---If none of the parents is visible focus root.
474474
---If node is nil do nothing.
475-
---@param node Node|nil node to focus
475+
---@param node Node? node to focus
476476
function M.focus_node_or_parent(node)
477477
local explorer = require("nvim-tree.core").get_explorer()
478478

@@ -548,7 +548,7 @@ function M.array_remove_nils(array)
548548
end, array)
549549
end
550550

551-
---@param f fun(node: Node|nil)
551+
---@param f fun(node: Node?)
552552
---@return function
553553
function M.inject_node(f)
554554
return function()

0 commit comments

Comments
 (0)