From cbf8762f15fac03a51eaa2c6f983d4a5045c95b4 Mon Sep 17 00:00:00 2001 From: Raphael Date: Tue, 13 Dec 2022 20:07:09 +0800 Subject: fix: run all matched client in LspStart (#2314) --- lua/lspconfig/util.lua | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'lua/lspconfig/util.lua') diff --git a/lua/lspconfig/util.lua b/lua/lspconfig/util.lua index f7614924..b38b8ec6 100644 --- a/lua/lspconfig/util.lua +++ b/lua/lspconfig/util.lua @@ -438,8 +438,22 @@ function M.get_other_matching_providers(filetype) return other_matching_configs end +function M.get_config_by_ft(filetype) + local configs = require 'lspconfig.configs' + local matching_configs = {} + for _, config in pairs(configs) do + local filetypes = config.filetypes or {} + for _, ft in pairs(filetypes) do + if ft == filetype then + table.insert(matching_configs, config) + end + end + end + return matching_configs +end + function M.get_active_client_by_name(bufnr, servername) - for _, client in pairs(vim.lsp.buf_get_clients(bufnr)) do + for _, client in pairs(vim.lsp.get_active_clients { bufnr = bufnr }) do if client.name == servername then return client end -- cgit v1.2.3-70-g09d2