From ee342d3cef97aa2414c05261b448228ae3277862 Mon Sep 17 00:00:00 2001 From: Jose Alvarez Date: Mon, 11 Oct 2021 11:52:11 -0400 Subject: fix(lsp): maintain client_ids table structure when filtering (#15991) --- runtime/lua/vim/lsp.lua | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'runtime') diff --git a/runtime/lua/vim/lsp.lua b/runtime/lua/vim/lsp.lua index 66a8356735..9c35351608 100644 --- a/runtime/lua/vim/lsp.lua +++ b/runtime/lua/vim/lsp.lua @@ -144,9 +144,13 @@ local function for_each_buffer_client(bufnr, fn, restrict_client_ids) end if restrict_client_ids and #restrict_client_ids > 0 then - client_ids = vim.tbl_filter(function(item) - return vim.tbl_contains(restrict_client_ids, item) - end, vim.tbl_keys(client_ids)) + local filtered_client_ids = {} + for client_id in pairs(client_ids) do + if vim.tbl_contains(restrict_client_ids, client_id) then + filtered_client_ids[client_id] = true + end + end + client_ids = filtered_client_ids end for client_id in pairs(client_ids) do -- cgit