Skip to content

Commit

Permalink
Support earlier neovim that lack tbl_isarray
Browse files Browse the repository at this point in the history
  • Loading branch information
chipsenkbeil committed Jun 26, 2023
1 parent dba1d06 commit a4fb360
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lua/distant-core/ui/nodes.lua
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,12 @@ function M.Table(rows, extra)
end
end

if type(extra) == 'table' and vim.tbl_isarray(extra) then
-- 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

if type(extra) == 'table' and isarray(extra) then
--- @type distant.core.ui.INode[]
local rows_with_extra = {}

Expand Down

0 comments on commit a4fb360

Please sign in to comment.