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

feat(lsp): add support for neovim 0.10 lsp api #82

Merged
merged 1 commit into from
May 19, 2024
Merged
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
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