From 4d04feb6629cb049cb2a13ba35f0c8d3c6b67ff4 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Fri, 14 Apr 2023 10:39:57 +0200 Subject: 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. --- runtime/lua/provider/health.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'runtime/lua/provider') diff --git a/runtime/lua/provider/health.lua b/runtime/lua/provider/health.lua index 8ebc8ccb17..a5fe14732c 100644 --- a/runtime/lua/provider/health.lua +++ b/runtime/lua/provider/health.lua @@ -449,7 +449,7 @@ local function python() local path_bin = vim.fs.normalize(path .. '/' .. pyname) if path_bin ~= vim.fs.normalize(python_exe) - and vim.tbl_contains(python_multiple, path_bin) + and vim.list_contains(python_multiple, path_bin) and executable(path_bin) then python_multiple[#python_multiple + 1] = path_bin -- cgit