Procházet zdrojové kódy

fix(core/autocmds): do not check for existence on clear_augroup (#2963)

fix #2952

Co-authored-by: kylo252 <59826753+kylo252@users.noreply.github.com>

Co-authored-by: kylo252 <59826753+kylo252@users.noreply.github.com>
lvimuser před 2 roky
rodič
revize
2519e07423
1 změnil soubory, kde provedl 3 přidání a 11 odebrání
  1. 3 11
      lua/lvim/core/autocmds.lua

+ 3 - 11
lua/lvim/core/autocmds.lua

@@ -155,19 +155,11 @@ end
 ---@param name string the augroup name
 function M.clear_augroup(name)
   -- defer the function in case the autocommand is still in-use
-  local exists, _ = pcall(vim.api.nvim_get_autocmds, { group = name })
-  if not exists then
-    Log:debug("ignoring request to clear autocmds from non-existent group " .. name)
-    return
-  end
+  Log:debug("request to clear autocmds  " .. name)
   vim.schedule(function()
-    local status_ok, _ = xpcall(function()
+    pcall(function()
       vim.api.nvim_clear_autocmds { group = name }
-    end, debug.traceback)
-    if not status_ok then
-      Log:warn("problems detected while clearing autocmds from " .. name)
-      Log:debug(debug.traceback())
-    end
+    end)
   end)
 end