Parcourir la source

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

lvimuser il y a 3 ans
Parent
commit
b8f681374b
1 fichiers modifiés avec 2 ajouts et 2 suppressions
  1. 2 2
      lua/lvim/lsp/manager.lua

+ 2 - 2
lua/lvim/lsp/manager.lua

@@ -37,9 +37,9 @@ end
 -- which seems to occur only when attaching to single-files
 local function client_is_configured(server_name, ft)
   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
-    if result:match(server_name) then
+    if result.command:match(server_name) then
       Log:debug(string.format("[%q] is already configured", server_name))
       return true
     end