From 805df629dc7fa1a352adc8b7897cf3e1842d5d26 Mon Sep 17 00:00:00 2001 From: Squibid Date: Sat, 9 Mar 2024 00:21:19 -0500 Subject: get lsp server name more consistently for the statusbar --- lua/core/statusbar/components.lua | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'lua/core/statusbar/components.lua') diff --git a/lua/core/statusbar/components.lua b/lua/core/statusbar/components.lua index cce3127..f731688 100644 --- a/lua/core/statusbar/components.lua +++ b/lua/core/statusbar/components.lua @@ -239,15 +239,11 @@ end function M.lsp_srvname(opts) local fmt = opts.fmt or "%s" local icon = opts.icon or "" - local buf_clients = vim.lsp.buf_get_clients(0) - if not buf_clients or #buf_clients == 0 then - return "" - end local names = "" - for i, c in ipairs(buf_clients) do - if i > 1 then names = names .. ", " end - names = names .. c.name - end + vim.lsp.for_each_buffer_client(0, function(client) + if names ~= "" then names = names..", " end + names = names..client.name + end) return icon..fmt:format(names) end -- cgit v1.2.1