mirror of
https://github.com/neovim/neovim.git
synced 2025-12-10 00:22:41 +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:
@@ -42,7 +42,7 @@ local function execute_lens(lens, bufnr, client_id)
|
||||
-- Need to use the client that returned the lens → must not use buf_request
|
||||
local command_provider = client.server_capabilities.executeCommandProvider
|
||||
local commands = type(command_provider) == 'table' and command_provider.commands or {}
|
||||
if not vim.tbl_contains(commands, command.command) then
|
||||
if not vim.list_contains(commands, command.command) then
|
||||
vim.notify(
|
||||
string.format(
|
||||
'Language server does not support command `%s`. This command may require a client extension.',
|
||||
|
||||
Reference in New Issue
Block a user