lint: stricter type checking

This commit is contained in:
Steven Arcangeli 2024-08-30 17:09:56 -07:00
parent f60bb7f793
commit 1360be5fda
9 changed files with 25 additions and 3 deletions

View file

@ -34,6 +34,9 @@ local function read_link_data(path, cb)
)
end
---@class (exact) oil.FilesAdapter: oil.Adapter
---@field to_short_os_path fun(path: string, entry_type: nil|oil.EntryType): string
---@param path string
---@param entry_type nil|oil.EntryType
---@return string
@ -284,6 +287,7 @@ end
---@param column_defs string[]
---@param cb fun(err?: string, entries?: oil.InternalEntry[], fetch_more?: fun())
local function list_windows_drives(url, column_defs, cb)
---@cast M oil.FilesAdapter
local fetch_meta = columns.get_metadata_fetcher(M, column_defs)
local stdout = ""
local jid = vim.fn.jobstart({ "wmic", "logicaldisk", "get", "name" }, {
@ -341,6 +345,7 @@ M.list = function(url, column_defs, cb)
return list_windows_drives(url, column_defs, cb)
end
local dir = fs.posix_to_os_path(path)
---@cast M oil.Adapter
local fetch_meta = columns.get_metadata_fetcher(M, column_defs)
---@diagnostic disable-next-line: param-type-mismatch, discard-returns

View file

@ -50,6 +50,7 @@ M.parse_url = function(oil_url)
error(string.format("Malformed SSH url: %s", oil_url))
end
---@cast ret oil.sshUrl
return ret
end
@ -440,6 +441,7 @@ M.goto_file = function()
url.path = vim.fs.dirname(fullpath)
local parurl = url_to_str(url)
---@cast M oil.Adapter
util.adapter_list_all(M, parurl, {}, function(err, entries)
if err then
vim.notify(string.format("Error finding file '%s': %s", fname, err), vim.log.levels.ERROR)

View file

@ -176,6 +176,7 @@ function SSHConnection.new(url)
end
end)
---@cast self oil.sshConnection
return self
end

View file

@ -70,6 +70,7 @@ end
---@param url oil.sshUrl
---@return oil.sshFs
function SSHFS.new(url)
---@type oil.sshFs
return setmetatable({
conn = SSHConnection.new(url),
}, {

View file

@ -210,6 +210,7 @@ local function read_trash_info(info_file, cb)
cb(".trashinfo file points to non-existant file")
else
trash_info.stat = trash_stat
---@cast trash_info oil.TrashInfo
cb(nil, trash_info)
end
end)

View file

@ -22,6 +22,7 @@ function PowershellConnection.new(init_command)
self:_init(init_command)
---@type oil.PowershellConnection
return self
end