diff options
| author | Justin M. Keyes <justinkz@gmail.com> | 2025-04-05 15:49:12 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-04-05 15:49:12 -0700 |
| commit | 52d857c603eab0a51d1bedd7ec9538a42f88b469 (patch) | |
| tree | 3e4677ef16a21a57346176d87856ce334202afc6 /lua/lspconfig | |
| parent | feat: require Nvim 0.10+ #3692 (diff) | |
| download | nvim-lspconfig-52d857c603eab0a51d1bedd7ec9538a42f88b469.tar nvim-lspconfig-52d857c603eab0a51d1bedd7ec9538a42f88b469.tar.gz nvim-lspconfig-52d857c603eab0a51d1bedd7ec9538a42f88b469.tar.bz2 nvim-lspconfig-52d857c603eab0a51d1bedd7ec9538a42f88b469.tar.lz nvim-lspconfig-52d857c603eab0a51d1bedd7ec9538a42f88b469.tar.xz nvim-lspconfig-52d857c603eab0a51d1bedd7ec9538a42f88b469.tar.zst nvim-lspconfig-52d857c603eab0a51d1bedd7ec9538a42f88b469.zip | |
refactor: deprecate util functions #3691
These are only used by the old health.lua, which only exists for Nvim 0.10 back-compat.
Diffstat (limited to 'lua/lspconfig')
| -rw-r--r-- | lua/lspconfig/util.lua | 66 |
1 files changed, 34 insertions, 32 deletions
diff --git a/lua/lspconfig/util.lua b/lua/lspconfig/util.lua index ae891010..1e6b64a7 100644 --- a/lua/lspconfig/util.lua +++ b/lua/lspconfig/util.lua @@ -157,38 +157,6 @@ function M.insert_package_json(config_files, field, fname) return config_files end -function M.get_active_clients_list_by_ft(filetype) - local clients = M.get_lsp_clients() - local clients_list = {} - for _, client in pairs(clients) do - --- @diagnostic disable-next-line:undefined-field - local filetypes = client.config.filetypes or {} - for _, ft in pairs(filetypes) do - if ft == filetype then - table.insert(clients_list, client.name) - end - end - end - return clients_list -end - -function M.get_other_matching_providers(filetype) - local configs = require 'lspconfig.configs' - local active_clients_list = M.get_active_clients_list_by_ft(filetype) - local other_matching_configs = {} - for _, config in pairs(configs) do - if not vim.tbl_contains(active_clients_list, config.name) then - local filetypes = config.filetypes or {} - for _, ft in pairs(filetypes) do - if ft == filetype then - table.insert(other_matching_configs, config) - end - end - end - end - return other_matching_configs -end - function M.get_config_by_ft(filetype) local configs = require 'lspconfig.configs' local matching_configs = {} @@ -362,4 +330,38 @@ function M.find_git_ancestor(startpath) return vim.fs.dirname(vim.fs.find('.git', { path = startpath, upward = true })[1]) end +--- @deprecated Will be removed. Do not use. +function M.get_active_clients_list_by_ft(filetype) + local clients = M.get_lsp_clients() + local clients_list = {} + for _, client in pairs(clients) do + --- @diagnostic disable-next-line:undefined-field + local filetypes = client.config.filetypes or {} + for _, ft in pairs(filetypes) do + if ft == filetype then + table.insert(clients_list, client.name) + end + end + end + return clients_list +end + +--- @deprecated Will be removed. Do not use. +function M.get_other_matching_providers(filetype) + local configs = require 'lspconfig.configs' + local active_clients_list = M.get_active_clients_list_by_ft(filetype) + local other_matching_configs = {} + for _, config in pairs(configs) do + if not vim.tbl_contains(active_clients_list, config.name) then + local filetypes = config.filetypes or {} + for _, ft in pairs(filetypes) do + if ft == filetype then + table.insert(other_matching_configs, config) + end + end + end + end + return other_matching_configs +end + return M |
