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

@@ -7,11 +7,16 @@ local M = {}
M.explore = require("nvim-tree.explorer.explore").explore
M.reload = require("nvim-tree.explorer.reload").reload
---@class Explorer: BaseNode
local Explorer = {}
Explorer.__index = Explorer
---@param cwd string|nil
---@return Explorer
function Explorer.new(cwd)
cwd = vim.loop.fs_realpath(cwd or vim.loop.cwd())
---@class Explorer
local explorer = setmetatable({
absolute_path = cwd,
nodes = {},
@@ -22,12 +27,15 @@ function Explorer.new(cwd)
return explorer
end
---@private
---@param node Node
function Explorer:_load(node)
local cwd = node.link_to or node.absolute_path
local git_status = git.load_project_status(cwd)
M.explore(node, git_status)
end
---@param node Node
function Explorer:expand(node)
self:_load(node)
end