Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions lua/distant-core/api.lua
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ end
--- @param payload table
--- @return boolean
local function verify_dir_read(payload)
return payload.type == 'dir_entries' and vim.tbl_islist(payload.entries) and vim.tbl_islist(payload.errors)
return payload.type == 'dir_entries' and vim.islist(payload.entries) and vim.islist(payload.errors)
end

--- @param payload table
Expand All @@ -134,7 +134,7 @@ end
--- @param payload table
--- @return boolean
local function verify_file_read(payload)
return payload.type == 'blob' and vim.tbl_islist(payload.data)
return payload.type == 'blob' and vim.islist(payload.data)
end

--- @param payload table
Expand Down Expand Up @@ -307,7 +307,7 @@ function M:batch(opts, cb)
opts.interval = nil

-- Validate the payload by checking it contains types
assert(vim.tbl_islist(opts), 'Batch not provided a list of payloads')
assert(vim.islist(opts), 'Batch not provided a list of payloads')
--- @type distant.core.api.RequestHandlers[]
local handlers = {}
for idx, payload in ipairs(opts) do
Expand All @@ -323,7 +323,7 @@ function M:batch(opts, cb)
payload = opts,
header = { sequence = sequence },
verify = function(payload)
return type(payload) == 'table' and vim.tbl_islist(payload)
return type(payload) == 'table' and vim.islist(payload)
end,
map = function(payload)
-- Map errors versus regular responses
Expand Down
2 changes: 1 addition & 1 deletion lua/distant-core/api/transport.lua
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ function M:__handle_response(msg)
--- @return T
local function clean_payload(payload)
if type(payload) == 'table' then
if vim.tbl_islist(payload) then
if vim.islist(payload) then
return vim.tbl_map(clean_payload, payload)
else
for key, value in pairs(payload) do
Expand Down
2 changes: 1 addition & 1 deletion lua/distant-core/builder/cmd.lua
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function M:new(cmd, opts)
instance.__cmd = cmd
end

if vim.tbl_islist(opts.allowed) then
if vim.islist(opts.allowed) then
instance.__allowed = {}
for _, key in ipairs(opts.allowed) do
instance.__allowed[key] = true
Expand Down
2 changes: 1 addition & 1 deletion lua/distant-core/ui/nodes.lua
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ function M.Table(rows, extra)
-- For neovim 0.10+, `tbl_isarray` is the new `tbl_islist` whereas on earlier versions
-- there is no `tbl_isarray`; so, check if we have the new function and use it otherwise
-- fall back to the old function.
local isarray = vim.tbl_isarray or vim.tbl_islist
local isarray = vim.isarray or vim.islist

if type(extra) == 'table' and isarray(extra) then
--- @type distant.core.ui.INode[]
Expand Down
6 changes: 3 additions & 3 deletions lua/distant-core/utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ M.cache_path = function(path)
M.plugin_name()
)

if type(path) == 'table' and vim.tbl_islist(path) then
if type(path) == 'table' and vim.islist(path) then
for _, component in ipairs(path) do
full_path = full_path .. M.seperator() .. component
end
Expand All @@ -63,7 +63,7 @@ M.data_path = function(path)
M.plugin_name()
)

if type(path) == 'table' and vim.tbl_islist(path) then
if type(path) == 'table' and vim.islist(path) then
for _, component in ipairs(path) do
full_path = full_path .. M.seperator() .. component
end
Expand Down Expand Up @@ -251,7 +251,7 @@ end
--- @return string #The path as a string
M.join_path = function(sep, paths)
assert(type(sep) == 'string', 'sep must be a string')
assert(vim.tbl_islist(paths), 'paths must be a list')
assert(vim.islist(paths), 'paths must be a list')
local path = ''

for _, component in ipairs(paths) do
Expand Down
2 changes: 1 addition & 1 deletion spec/e2e/driver.lua
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,7 @@ function M:new_dir_fixture(opts)
local file = rd:file(item)
assert(file:touch(), 'Failed to create file: ' .. file:path())
end
elseif vim.tbl_islist(item) and #item == 2 then
elseif vim.islist(item) and #item == 2 then
local symlink = rd:symlink(item[1])
local target = rd:file(item[2]):path()
assert(symlink:make(target), 'Failed to create symlink: ' .. symlink:path() .. ' to ' .. target)
Expand Down