mirror of
https://github.com/LunarVim/LunarVim.git
synced 2024-09-21 02:55:09 +02:00
28 lines
605 B
Lua
28 lines
605 B
Lua
local M = {}
|
|
|
|
function M.is_client_active(name)
|
|
local clients = vim.lsp.get_active_clients()
|
|
for _, client in pairs(clients) do
|
|
if client.name == name then
|
|
return true, client
|
|
end
|
|
end
|
|
return false
|
|
end
|
|
|
|
-- FIXME: this should return a list instead
|
|
function M.get_active_client_by_ft(filetype)
|
|
if not lvim.lang[filetype] or not lvim.lang[filetype].lsp then
|
|
return nil
|
|
end
|
|
|
|
local clients = vim.lsp.get_active_clients()
|
|
for _, client in pairs(clients) do
|
|
if client.name == lvim.lang[filetype].lsp.provider then
|
|
return client
|
|
end
|
|
end
|
|
return nil
|
|
end
|
|
|
|
return M
|