aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/editorconfig.lua
diff options
context:
space:
mode:
authorChristian Clason <c.clason@uni-graz.at>2023-04-14 10:39:57 +0200
committerGitHub <noreply@github.com>2023-04-14 10:39:57 +0200
commit4d04feb6629cb049cb2a13ba35f0c8d3c6b67ff4 (patch)
tree17dadca32fa46116a9c576fc651a61bc5da8ece4 /runtime/lua/editorconfig.lua
parent72a327cad20fa2dbb214177cc48c533543d5b9e8 (diff)
downloadrneovim-4d04feb6629cb049cb2a13ba35f0c8d3c6b67ff4.tar.gz
rneovim-4d04feb6629cb049cb2a13ba35f0c8d3c6b67ff4.tar.bz2
rneovim-4d04feb6629cb049cb2a13ba35f0c8d3c6b67ff4.zip
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.
Diffstat (limited to 'runtime/lua/editorconfig.lua')
-rw-r--r--runtime/lua/editorconfig.lua2
1 files changed, 1 insertions, 1 deletions
diff --git a/runtime/lua/editorconfig.lua b/runtime/lua/editorconfig.lua
index 5b09126788..5188c13284 100644
--- a/runtime/lua/editorconfig.lua
+++ b/runtime/lua/editorconfig.lua
@@ -26,7 +26,7 @@ end
function M.properties.charset(bufnr, val)
assert(
- vim.tbl_contains({ 'utf-8', 'utf-8-bom', 'latin1', 'utf-16be', 'utf-16le' }, val),
+ vim.list_contains({ 'utf-8', 'utf-8-bom', 'latin1', 'utf-16be', 'utf-16le' }, val),
'charset must be one of "utf-8", "utf-8-bom", "latin1", "utf-16be", or "utf-16le"'
)
if val == 'utf-8' or val == 'utf-8-bom' then