diff options
author | Luc Sinet <[email protected]> | 2021-08-13 22:32:56 +0200 |
---|---|---|
committer | GitHub <[email protected]> | 2021-08-14 01:02:56 +0430 |
commit | 70d139ac2771fac9b072aaebe505f9ac77480b2a (patch) | |
tree | f914460477982486f20bb00676f8a36c89618635 /lua/lsp/utils.lua | |
parent | 53869f00be7eda020088342e6e1a160ef5fc2a53 (diff) |
[Refactor/Bugfix] Improve null ls handler (#1277)
Diffstat (limited to 'lua/lsp/utils.lua')
-rw-r--r-- | lua/lsp/utils.lua | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/lua/lsp/utils.lua b/lua/lsp/utils.lua new file mode 100644 index 00000000..e28c6085 --- /dev/null +++ b/lua/lsp/utils.lua @@ -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 |