kylechui / nvim-surround

Add/change/delete surrounding delimiter pairs with ease. Written with :heart: in Lua.
MIT License
2.9k stars 60 forks source link

Adapt to deprecated Neovim API #321

Closed clason closed 1 month ago

clason commented 1 month ago

In Neovim 0.10 (just released), vim.tbl_islist() is deprecated in favor of vim.islist(). This means that nightly users will get a warning on every nvim-surround action.

Solution: introduce a

local islist = vim.fn.has('nvim-0.10') == 1 and vim.islist or vim.tbl_islist
clason commented 1 month ago

Actually, that function does not do what you think it does ;) It checks whether t is a list-like table (integer-indexed without holes). What you want is just type(t) == 'table'