chore: add type annotations and resolve LSP warnings (#2555)
* chore: add type annotations to (almost) all functions
* stylua
* Add classes for symlink nodes
* Replace deprecated `@vararg`
* Move node classes to `node` module
* Fix `Symlink*` classes
* add vim and libuv runtime for luals, qualify libuv types
* add scripts/luals-check, not quite ready for CI
* additional nil checks for git/init.lua and git/runner.lua
* additional nil checks for nvim-tree.lua
* wrap vim.cmd-as-a-function calls inside functions
* vim.tbl_filter predicate returns booleans
* Revert "add scripts/luals-check, not quite ready for CI"
This reverts commit c70229cad9.
* Add `MinimalNode` class in `marks` module
* Fix various LSP warnings
* stylua
* Fix `Explorer` class, update related annotations and add necessary checks
* Add missing annotations to `live-filter`
* Add temporary aliases for `uv.*` types
* Resolve remaining LSP warnings
* Revert changes not related to internal types
* Minor adjustments
* Update doc comments style
* Minor adjustments (pt. 2)
---------
Co-authored-by: Alexander Courtis <alex@courtis.org>
This commit is contained in:
@@ -6,9 +6,9 @@ local M = {
|
||||
}
|
||||
|
||||
--- Retrieve the git toplevel directory
|
||||
--- @param cwd string path
|
||||
--- @return string|nil toplevel absolute path
|
||||
--- @return string|nil git_dir absolute path
|
||||
---@param cwd string path
|
||||
---@return string|nil toplevel absolute path
|
||||
---@return string|nil git_dir absolute path
|
||||
function M.get_toplevel(cwd)
|
||||
local profile = log.profile_start("git toplevel git_dir %s", cwd)
|
||||
|
||||
@@ -60,6 +60,8 @@ end
|
||||
|
||||
local untracked = {}
|
||||
|
||||
---@param cwd string
|
||||
---@return string|nil
|
||||
function M.should_show_untracked(cwd)
|
||||
if untracked[cwd] ~= nil then
|
||||
return untracked[cwd]
|
||||
@@ -79,12 +81,18 @@ function M.should_show_untracked(cwd)
|
||||
return untracked[cwd]
|
||||
end
|
||||
|
||||
---@param t table|nil
|
||||
---@param k string
|
||||
---@return table
|
||||
local function nil_insert(t, k)
|
||||
t = t or {}
|
||||
t[k] = true
|
||||
return t
|
||||
end
|
||||
|
||||
---@param status table
|
||||
---@param cwd string|nil
|
||||
---@return table
|
||||
function M.file_status_to_dir_status(status, cwd)
|
||||
local direct = {}
|
||||
for p, s in pairs(status) do
|
||||
|
||||
Reference in New Issue
Block a user