aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJose Alvarez <j.alvarez11@icloud.com>2021-10-11 11:52:11 -0400
committerGitHub <noreply@github.com>2021-10-11 08:52:11 -0700
commitee342d3cef97aa2414c05261b448228ae3277862 (patch)
tree48375ae3d397d944491c7603c1174a1220a54c2f
parentd288daac2bdc7e1e7da58656cd26a4311811120c (diff)
downloadrneovim-ee342d3cef97aa2414c05261b448228ae3277862.tar.gz
rneovim-ee342d3cef97aa2414c05261b448228ae3277862.tar.bz2
rneovim-ee342d3cef97aa2414c05261b448228ae3277862.zip
fix(lsp): maintain client_ids table structure when filtering (#15991)
-rw-r--r--runtime/lua/vim/lsp.lua10
1 files changed, 7 insertions, 3 deletions
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