Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(issue #229): Concatenate all lsp client names found by GetLspClient #230

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion lua/galaxyline/provider_diagnostic.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ local function get_nvim_lsp_diagnostic(diag_type)
local active_clients = lsp.get_active_clients()

if active_clients then
local count = #diagnostic.get(vim.api.nvim_get_current_buf(), { severity = diag_type })
local count = 0

for _, client in ipairs(active_clients) do
count = count + table.getn(diagnostic.get(api.nvim_get_current_buf(),{ severity = diag_type }))
end
if count ~= 0 then return count .. ' ' end
end
end
Expand Down
20 changes: 18 additions & 2 deletions lua/galaxyline/provider_lsp.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
function pconcat(tab)
local ctab, n = {}, 1
for k, _ in pairs(tab) do
ctab[n] = k
n = n + 1
end
return table.concat(ctab, ',')
end

local get_lsp_client = function (msg)
msg = msg or 'No Active Lsp'
local buf_ft = vim.api.nvim_buf_get_option(0,'filetype')
Expand All @@ -6,13 +15,20 @@ local get_lsp_client = function (msg)
return msg
end

local tbl_names = {}
for _,client in ipairs(clients) do
local filetypes = client.config.filetypes
if filetypes and vim.fn.index(filetypes,buf_ft) ~= -1 then
return client.name
tbl_names[client.name] = true
end
end
return msg

client_name = pconcat(tbl_names)
if client_name:len() > 0 then
return client_name
else
return msg
end
end

return {
Expand Down