mirror of
https://github.com/LunarVim/LunarVim.git
synced 2025-08-30 22:59:22 +02:00
[Refactor/Bugfix] Improve null ls handler (#1277)
This commit is contained in:
parent
53869f00be
commit
70d139ac27
11 changed files with 577 additions and 474 deletions
27
lua/lsp/utils.lua
Normal file
27
lua/lsp/utils.lua
Normal file
|
@ -0,0 +1,27 @@
|
|||
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
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
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
|
Loading…
Add table
Add a link
Reference in a new issue