Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: use vim.islist() instead of deprecated vim.tbl_islist() #454

Merged
merged 1 commit into from
May 17, 2024
Merged
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
6 changes: 4 additions & 2 deletions lua/legendary/data/keymap.lua
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ end
---Bind the keymap in Neovim
---@return Keymap
function Keymap:apply()
if vim.tbl_islist(self.mode_mappings) then
local islist = vim.islist or vim.tbl_islist
if islist(self.mode_mappings) then
-- description-only keymap
return self
end
Expand All @@ -133,7 +134,8 @@ function Keymap:frecency_id()
end

function Keymap:modes()
if vim.tbl_islist(self.mode_mappings) then
local islist = vim.islist or vim.tbl_islist
if islist(self.mode_mappings) then
return self.mode_mappings
end

Expand Down
6 changes: 4 additions & 2 deletions lua/legendary/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ local function build_parser_func(parser)
return
end

if not vim.tbl_islist(items) then
local islist = vim.islist or vim.tbl_islist
if not islist(items) then
error(string.format('Expected list, got ', type(items)))
return
end
Expand Down Expand Up @@ -159,7 +160,8 @@ end
---Bind a *list of* autocmds and/or augroups
---@param aus table
function M.autocmds(aus)
if not vim.tbl_islist(aus) then
local islist = vim.islist or vim.tbl_islist
if not islist(aus) then
Log.error('Expected list, got %s.\n %s', type(aus), vim.inspect(aus))
return
end
Expand Down
Loading