Skip to content

Commit

Permalink
feat(lsp): add support for neovim 0.10 lsp api (#82)
Browse files Browse the repository at this point in the history
  • Loading branch information
freddiehaddad authored May 19, 2024
1 parent b43be71 commit 43766d0
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
doc/tags
/luarocks
/lua
/lua_modules
/.luarocks
1 change: 0 additions & 1 deletion .tmux.conf

This file was deleted.

19 changes: 15 additions & 4 deletions lua/feline/providers/lsp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@ local lsp = vim.lsp
local diagnostic = vim.diagnostic

function M.is_lsp_attached()
return next(lsp.get_active_clients { bufnr = 0 }) ~= nil
if vim.fn.has('nvim-0.10') > 0 then
return next(lsp.get_clients { bufnr = 0 }) ~= nil
else
---@diagnostic disable-next-line: deprecated
return next(lsp.get_active_clients { bufnr = 0 }) ~= nil
end
end

function M.get_diagnostics_count(severity)
Expand All @@ -17,9 +22,15 @@ end

function M.lsp_client_names()
local clients = {}

for _, client in pairs(lsp.get_active_clients { bufnr = 0 }) do
clients[#clients + 1] = client.name
if vim.fn.has('nvim-0.10') > 0 then
for _, client in pairs(lsp.get_clients { bufnr = 0 }) do
clients[#clients + 1] = client.name
end
else
---@diagnostic disable-next-line: deprecated
for _, client in pairs(lsp.get_active_clients { bufnr = 0 }) do
clients[#clients + 1] = client.name
end
end

return table.concat(clients, ' '), ''
Expand Down

0 comments on commit 43766d0

Please sign in to comment.