feat: nvim lsp integration (#260)

This commit is contained in:
Kiyan
2021-04-08 23:30:35 +02:00
committed by GitHub
parent 50d31fb7f3
commit 82b20f5b5e
6 changed files with 83 additions and 2 deletions

View File

@@ -64,4 +64,22 @@ function M.path_remove_trailing(path)
end
M.path_separator = path_separator
-- get the node from the tree that matches the predicate
-- @param nodes list of node
-- @param fn function(node): boolean
function M.find_node(nodes, fn)
local i = 1
for _, node in ipairs(nodes) do
if fn(node) then return node, i end
if node.open and #node.entries > 0 then
local n, idx = M.find_node(node.entries, fn)
i = i + idx
if n then return n, i end
end
i = i + 1
end
return nil, i
end
return M