fix(lvim/lsp/manager): make client_is_configured more reliable (#2851)

This commit is contained in:
lvimuser 2022-07-31 11:51:12 -03:00 committed by GitHub
parent caac70d22e
commit b8f681374b
WARNING! Although there is a key with this ID in the database it does not verify this commit! This commit is SUSPICIOUS.
GPG key ID: 4AEE18F83AFDEB23

View file

@ -37,9 +37,9 @@ end
-- which seems to occur only when attaching to single-files -- which seems to occur only when attaching to single-files
local function client_is_configured(server_name, ft) local function client_is_configured(server_name, ft)
ft = ft or vim.bo.filetype ft = ft or vim.bo.filetype
local active_autocmds = vim.split(vim.fn.execute("autocmd FileType " .. ft), "\n") local active_autocmds = vim.api.nvim_get_autocmds { event = "FileType", pattern = ft }
for _, result in ipairs(active_autocmds) do for _, result in ipairs(active_autocmds) do
if result:match(server_name) then if result.command:match(server_name) then
Log:debug(string.format("[%q] is already configured", server_name)) Log:debug(string.format("[%q] is already configured", server_name))
return true return true
end end