chore: add type annotations to (almost) all functions

This commit is contained in:
Akmadan23
2023-11-24 12:01:24 +01:00
parent 46e1f776f0
commit fabea3376e
48 changed files with 438 additions and 83 deletions

View File

@@ -8,6 +8,7 @@ local find_file = require("nvim-tree.actions.finders.find-file").fn
local M = {}
---@param file string
local function create_and_notify(file)
events._dispatch_will_create_file(file)
local ok, fd = pcall(vim.loop.fs_open, file, "w", 420)
@@ -19,6 +20,8 @@ local function create_and_notify(file)
events._dispatch_file_created(file)
end
---@param iter function iterable
---@return integer
local function get_num_nodes(iter)
local i = 0
for _ in iter do
@@ -27,6 +30,8 @@ local function get_num_nodes(iter)
return i
end
---@param node Node
---@return string
local function get_containing_folder(node)
if node.nodes ~= nil then
return utils.path_add_trailing(node.absolute_path)
@@ -35,6 +40,7 @@ local function get_containing_folder(node)
return node.absolute_path:sub(0, -node_name_size - 1)
end
---@param node Node|nil
function M.fn(node)
node = node and lib.get_last_group_node(node)
if not node or node.name == ".." then