소스 검색

fix(config-loader): defer invalid configuration warning (#3869)

LostNeophyte 2 년 전
부모
커밋
a7e7f28639
1개의 변경된 파일8개의 추가작업 그리고 4개의 파일을 삭제
  1. 8 4
      lua/lvim/config/init.lua

+ 8 - 4
lua/lvim/config/init.lua

@@ -51,11 +51,15 @@ function M:load(config_path)
   local ok, err = pcall(dofile, config_path)
   local ok, err = pcall(dofile, config_path)
   if not ok then
   if not ok then
     if utils.is_file(user_config_file) then
     if utils.is_file(user_config_file) then
-      Log:warn("Invalid configuration: " .. err)
+      vim.schedule(function()
+        Log:warn("Invalid configuration: " .. err)
+      end)
     else
     else
-      vim.notify_once(
-        string.format("User-configuration not found. Creating an example configuration in %s", config_path)
-      )
+      vim.schedule(function()
+        vim.notify_once(
+          string.format("User-configuration not found. Creating an example configuration in %s", config_path)
+        )
+      end)
       local config_name = vim.loop.os_uname().version:match "Windows" and "config_win" or "config"
       local config_name = vim.loop.os_uname().version:match "Windows" and "config_win" or "config"
       local example_config = join_paths(get_lvim_base_dir(), "utils", "installer", config_name .. ".example.lua")
       local example_config = join_paths(get_lvim_base_dir(), "utils", "installer", config_name .. ".example.lua")
       vim.fn.mkdir(user_config_dir, "p")
       vim.fn.mkdir(user_config_dir, "p")