committed by
GitHub
parent
47732b6dbf
commit
82ec79aac5
@@ -123,6 +123,29 @@ function M.find_node(nodes, fn)
|
||||
return node, i
|
||||
end
|
||||
|
||||
-- return visible nodes indexed by line
|
||||
-- @param nodes_all list of node
|
||||
-- @param line_start first index
|
||||
---@return table
|
||||
function M.get_nodes_by_line(nodes_all, line_start)
|
||||
local nodes_by_line = {}
|
||||
local line = line_start
|
||||
local function iter(nodes)
|
||||
for _, node in ipairs(nodes) do
|
||||
nodes_by_line[line] = node
|
||||
line = line + 1
|
||||
if node.open == true then
|
||||
local child = iter(node.nodes)
|
||||
if child ~= nil then
|
||||
return child
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
iter(nodes_all)
|
||||
return nodes_by_line
|
||||
end
|
||||
|
||||
---Matching executable files in Windows.
|
||||
---@param ext string
|
||||
---@return boolean
|
||||
|
||||
Reference in New Issue
Block a user