fix(statusline): fix lsp active clients

This commit is contained in:
Matt Leong 2021-11-11 14:43:20 -08:00
parent ff3a7a5de4
commit 7fc6a26751

View file

@ -39,9 +39,13 @@ end
function M.get_active_lsp_client_names()
local active_clients = vim.lsp.get_active_clients()
local client_names = {}
for i, client in pairs(active_clients) do
for i, client in pairs(active_clients or {}) do
local buf = vim.api.nvim_get_current_buf()
-- only return attached buffers
if vim.lsp.buf_is_attached(buf, client.id) then
table.insert(client_names, i, client.name)
end
end
table.sort(client_names)
return client_names