mirror of
https://github.com/neovim/neovim.git
synced 2025-12-16 03:15:39 +00:00
feat(lua): vim.tbl_contains supports general tables and predicates (#23040)
* feat(lua): vim.tbl_contains supports general tables and predicates Problem: `vim.tbl_contains` only works for list-like tables (integer keys without gaps) and primitive values (in particular, not for nested tables). Solution: Rename `vim.tbl_contains` to `vim.list_contains` and add new `vim.tbl_contains` that works for general tables and optionally allows `value` to be a predicate function that is checked for every key.
This commit is contained in:
@@ -1476,7 +1476,7 @@ end
|
||||
local function close_preview_window(winnr, bufnrs)
|
||||
vim.schedule(function()
|
||||
-- exit if we are in one of ignored buffers
|
||||
if bufnrs and vim.tbl_contains(bufnrs, api.nvim_get_current_buf()) then
|
||||
if bufnrs and vim.list_contains(bufnrs, api.nvim_get_current_buf()) then
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user