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: Display all active LSPs as comma separated string #1222

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
18 changes: 9 additions & 9 deletions examples/evil_lualine.lua
Original file line number Diff line number Diff line change
Expand Up @@ -158,19 +158,19 @@ ins_left {
ins_left {
-- Lsp server name .
function()
local msg = 'No Active Lsp'
local buf_ft = vim.api.nvim_buf_get_option(0, 'filetype')
local clients = vim.lsp.get_active_clients()
local bufnr = vim.api.nvim_get_current_buf()
local clients = vim.lsp.get_clients { bufnr = bufnr }

if next(clients) == nil then
return msg
return 'No Active Lsp'
end

local active_lsps = {}
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
end
table.insert(active_lsps, client.name)
end
return msg

return table.concat(active_lsps, ', ')
end,
icon = ' LSP:',
color = { fg = '#ffffff', gui = 'bold' },
Expand Down
Loading