From fcc6a4aaffa983cdc28fa7409b90807e46ce08f8 Mon Sep 17 00:00:00 2001 From: Colin Kennedy Date: Fri, 17 May 2024 22:38:16 -0700 Subject: [PATCH] Changed vim.tbl_islist to vim.islist --- lua/dial/util.lua | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lua/dial/util.lua b/lua/dial/util.lua index 8032943..0acd16d 100644 --- a/lua/dial/util.lua +++ b/lua/dial/util.lua @@ -1,6 +1,9 @@ -- utils local M = {} +-- NOTE: Needed until compatibility with Neovim 0.9 is dropped +local islist = vim.fn.has('nvim-0.10') == 1 and vim.islist or vim.tbl_islist + ---@generic T ---@param cond boolean ---@param branch_true T @@ -38,7 +41,7 @@ end ---@param arg1 string | function ---@param arg2? string function M.validate_list(name, list, arg1, arg2) - if not vim.tbl_islist(list) then + if not islist(list) then error(("%s is not list."):format(name)) end @@ -160,7 +163,7 @@ end -- util.try_get_keys({foo = "bar", hoge = "fuga", teka = "pika"}, ["teka", "foo"]) -- -> ["pika", "bar"] function M.try_get_keys(tbl, keylst) - if not vim.tbl_islist(keylst) then + if not islist(keylst) then return nil, "the 2nd argument is not list." end