diff options
author | kylo252 <[email protected]> | 2021-10-10 21:07:41 +0200 |
---|---|---|
committer | GitHub <[email protected]> | 2021-10-10 21:07:41 +0200 |
commit | 52b74557415eb757ad4b7481b0aec8a3f98dd58d (patch) | |
tree | 9a05ec71a46c99fbdf8df0043be652b528c7c04e /lua/lsp/utils.lua | |
parent | e2c85df440564a62fd804555747b1652a6844a5e (diff) |
feat: add an independent lvim namespace (#1699)
Diffstat (limited to 'lua/lsp/utils.lua')
-rw-r--r-- | lua/lsp/utils.lua | 62 |
1 files changed, 0 insertions, 62 deletions
diff --git a/lua/lsp/utils.lua b/lua/lsp/utils.lua deleted file mode 100644 index 59003406..00000000 --- a/lua/lsp/utils.lua +++ /dev/null @@ -1,62 +0,0 @@ -local M = {} - -local tbl = require "utils.table" - -function M.is_client_active(name) - local clients = vim.lsp.get_active_clients() - return tbl.find_first(clients, function(client) - return client.name == name - end) -end - -function M.get_active_clients_by_ft(filetype) - local matches = {} - local clients = vim.lsp.get_active_clients() - for _, client in pairs(clients) do - local supported_filetypes = client.config.filetypes or {} - if client.name ~= "null-ls" and vim.tbl_contains(supported_filetypes, filetype) then - table.insert(matches, client) - end - end - return matches -end - -function M.get_client_capabilities(client_id) - if not client_id then - local buf_clients = vim.lsp.buf_get_clients() - for _, buf_client in ipairs(buf_clients) do - if buf_client.name ~= "null-ls" then - client_id = buf_client.id - break - end - end - end - if not client_id then - error "Unable to determine client_id" - return - end - - local client = vim.lsp.get_client_by_id(tonumber(client_id)) - - local enabled_caps = {} - for capability, status in pairs(client.resolved_capabilities) do - if status == true then - table.insert(enabled_caps, capability) - end - end - - return enabled_caps -end - -function M.get_supported_filetypes(server_name) - -- print("got filetypes query request for: " .. server_name) - local configs = require "lspconfig/configs" - pcall(require, ("lspconfig/" .. server_name)) - for _, config in pairs(configs) do - if config.name == server_name then - return config.document_config.default_config.filetypes or {} - end - end -end - -return M |