@@ -220,6 +220,38 @@ local function make_client_info(client, fname)
220220 return table.concat (info_lines , ' \n ' )
221221end
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+
223255local 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
0 commit comments