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,11 @@ local log = require "nvim-tree.log"
|
||||
|
||||
local M = {}
|
||||
|
||||
---@type Explorer|nil
|
||||
local TreeExplorer = nil
|
||||
local first_init_done = false
|
||||
|
||||
---@param foldername string
|
||||
function M.init(foldername)
|
||||
local profile = log.profile_start("core init %s", foldername)
|
||||
|
||||
@@ -23,6 +25,7 @@ function M.init(foldername)
|
||||
log.profile_end(profile)
|
||||
end
|
||||
|
||||
---@return Explorer|nil
|
||||
function M.get_explorer()
|
||||
return TreeExplorer
|
||||
end
|
||||
@@ -31,10 +34,12 @@ function M.reset_explorer()
|
||||
TreeExplorer = nil
|
||||
end
|
||||
|
||||
---@return string|nil
|
||||
function M.get_cwd()
|
||||
return TreeExplorer and TreeExplorer.absolute_path
|
||||
end
|
||||
|
||||
---@return integer
|
||||
function M.get_nodes_starting_line()
|
||||
local offset = 1
|
||||
if view.is_root_folder_visible(M.get_cwd()) then
|
||||
|
||||
Reference in New Issue
Block a user