Skip to content

Commit

Permalink
refactor!: make undocumented functions private
Browse files Browse the repository at this point in the history
Work on neovim#2079.
  • Loading branch information
dundargoc committed Jan 21, 2025
1 parent 3d4180a commit e1ac838
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
19 changes: 18 additions & 1 deletion lua/lspconfig/health.lua
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,23 @@ local function make_client_info(client, fname)
return table.concat(info_lines, '\n')
end

local function 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

local function check_lspconfig(bufnr)
bufnr = (bufnr and bufnr ~= -1) and bufnr or nil

Expand Down Expand Up @@ -267,7 +284,7 @@ local function check_lspconfig(bufnr)
end
end

local other_matching_configs = not bufnr and {} or util.get_other_matching_providers(buffer_filetype)
local other_matching_configs = not bufnr and {} or get_other_matching_providers(buffer_filetype)
if not vim.tbl_isempty(other_matching_configs) then
health.info(('Other clients that match the "%s" filetype:'):format(buffer_filetype))
for _, config in ipairs(other_matching_configs) do
Expand Down
17 changes: 0 additions & 17 deletions lua/lspconfig/util.lua
Original file line number Diff line number Diff line change
Expand Up @@ -172,23 +172,6 @@ function M.get_active_clients_list_by_ft(filetype)
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 = {}
Expand Down

0 comments on commit e1ac838

Please sign in to comment.