Skip to content

Commit e52bc77

Browse files
committed
refactor!: make undocumented functions private
Work on neovim#2079.
1 parent 3d4180a commit e52bc77

2 files changed

Lines changed: 33 additions & 33 deletions

File tree

lua/lspconfig/health.lua

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,38 @@ local function make_client_info(client, fname)
220220
return table.concat(info_lines, '\n')
221221
end
222222

223+
local function get_active_clients_list_by_ft(filetype)
224+
local clients = M.get_lsp_clients()
225+
local clients_list = {}
226+
for _, client in pairs(clients) do
227+
--- @diagnostic disable-next-line:undefined-field
228+
local filetypes = client.config.filetypes or {}
229+
for _, ft in pairs(filetypes) do
230+
if ft == filetype then
231+
table.insert(clients_list, client.name)
232+
end
233+
end
234+
end
235+
return clients_list
236+
end
237+
238+
local function get_other_matching_providers(filetype)
239+
local configs = require 'lspconfig.configs'
240+
local active_clients_list = get_active_clients_list_by_ft(filetype)
241+
local other_matching_configs = {}
242+
for _, config in pairs(configs) do
243+
if not vim.tbl_contains(active_clients_list, config.name) then
244+
local filetypes = config.filetypes or {}
245+
for _, ft in pairs(filetypes) do
246+
if ft == filetype then
247+
table.insert(other_matching_configs, config)
248+
end
249+
end
250+
end
251+
end
252+
return other_matching_configs
253+
end
254+
223255
local function check_lspconfig(bufnr)
224256
bufnr = (bufnr and bufnr ~= -1) and bufnr or nil
225257

@@ -267,7 +299,7 @@ local function check_lspconfig(bufnr)
267299
end
268300
end
269301

270-
local other_matching_configs = not bufnr and {} or util.get_other_matching_providers(buffer_filetype)
302+
local other_matching_configs = not bufnr and {} or get_other_matching_providers(buffer_filetype)
271303
if not vim.tbl_isempty(other_matching_configs) then
272304
health.info(('Other clients that match the "%s" filetype:'):format(buffer_filetype))
273305
for _, config in ipairs(other_matching_configs) do

lua/lspconfig/util.lua

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -157,38 +157,6 @@ function M.insert_package_json(config_files, field, fname)
157157
return config_files
158158
end
159159

160-
function M.get_active_clients_list_by_ft(filetype)
161-
local clients = M.get_lsp_clients()
162-
local clients_list = {}
163-
for _, client in pairs(clients) do
164-
--- @diagnostic disable-next-line:undefined-field
165-
local filetypes = client.config.filetypes or {}
166-
for _, ft in pairs(filetypes) do
167-
if ft == filetype then
168-
table.insert(clients_list, client.name)
169-
end
170-
end
171-
end
172-
return clients_list
173-
end
174-
175-
function M.get_other_matching_providers(filetype)
176-
local configs = require 'lspconfig.configs'
177-
local active_clients_list = M.get_active_clients_list_by_ft(filetype)
178-
local other_matching_configs = {}
179-
for _, config in pairs(configs) do
180-
if not vim.tbl_contains(active_clients_list, config.name) then
181-
local filetypes = config.filetypes or {}
182-
for _, ft in pairs(filetypes) do
183-
if ft == filetype then
184-
table.insert(other_matching_configs, config)
185-
end
186-
end
187-
end
188-
end
189-
return other_matching_configs
190-
end
191-
192160
function M.get_config_by_ft(filetype)
193161
local configs = require 'lspconfig.configs'
194162
local matching_configs = {}

0 commit comments

Comments
 (0)