@@ -62,14 +62,6 @@ function Result.failure(err)
6262 return setmetatable ({ success = false , value = nil , error = err }, Result )
6363end
6464
65- function Async .safe_schedule (callback )
66- if not vim .in_fast_event () then
67- callback ()
68- return
69- end
70- vim .schedule (callback )
71- end
72-
7365-- Wrap a function to return a promise
7466function Async .wrap (func )
7567 return function (...)
@@ -205,7 +197,7 @@ function Async.async(func)
205197 end )
206198
207199 if not status then
208- Async . safe_schedule (function ()
200+ vim . schedule (function ()
209201 vim .notify (' Async error: ' .. tostring (result ), vim .log .levels .ERROR )
210202 end )
211203 end
@@ -495,7 +487,7 @@ function ProgressWindow:update_entry(plugin_name, status, message)
495487
496488 if self .visible then
497489 -- Schedule UI updates to run in the main event loop
498- Async . safe_schedule (function ()
490+ vim . schedule (function ()
499491 self :refresh ()
500492 end )
501493 end
@@ -783,7 +775,7 @@ function Plugin:load_scripts(callback)
783775 end
784776 if type == ' file' and (name :match (' %.lua$' ) or name :match (' %.vim$' )) then
785777 local file_path = vim .fs .joinpath (plugin_dir , name )
786- Async . safe_schedule (function ()
778+ vim . schedule (function ()
787779 vim .cmd (' source ' .. vim .fn .fnameescape (file_path ))
788780 if callback then
789781 callback ()
@@ -919,7 +911,7 @@ function Plugin:theme(name)
919911 Async .async (function ()
920912 local installed = Async .await (self :is_installed ())
921913 if installed then
922- Async . safe_schedule (function ()
914+ vim . schedule (function ()
923915 vim .opt .rtp :append (vim .fs .joinpath (START_DIR , self .plugin_name ))
924916 vim .cmd .colorscheme (self .colorscheme )
925917 end )
@@ -995,7 +987,7 @@ function Plugin:install()
995987 lines = vim .split (lines , ' \n ' , { trimempty = true })
996988
997989 if # lines > 0 then
998- Async . safe_schedule (function ()
990+ vim . schedule (function ()
999991 ui :update_entry (self .name , self .status , lines [# lines ])
1000992 end )
1001993 end
@@ -1126,7 +1118,7 @@ function Plugin:update()
11261118 lines = vim .split (lines , ' \n ' , { trimempty = true })
11271119
11281120 if # lines > 0 then
1129- Async . safe_schedule (function ()
1121+ vim . schedule (function ()
11301122 ui :update_entry (self .name , self .status , lines [# lines ])
11311123 end )
11321124 end
@@ -1181,7 +1173,7 @@ function Plugin:install_with_retry()
11811173 lines = vim .split (lines , ' \n ' , { trimempty = true })
11821174
11831175 if # lines > 0 then
1184- Async . safe_schedule (function ()
1176+ vim . schedule (function ()
11851177 ui :update_entry (self .name , self .status , lines [# lines ])
11861178 end )
11871179 end
@@ -1540,7 +1532,7 @@ local function setup_auto_install()
15401532 -- When using strive in plugin folder
15411533 if vim .v .vim_did_enter == 1 then
15421534 -- UI has already initialized, schedule installation directly
1543- Async . safe_schedule (function ()
1535+ vim . schedule (function ()
15441536 M .log (' debug' , ' UI already initialized, installing plugins now' )
15451537 M .install ()
15461538 end )
@@ -1552,7 +1544,7 @@ local function setup_auto_install()
15521544 api .nvim_create_autocmd (' UIEnter' , {
15531545 group = api .nvim_create_augroup (' strive_auto_install' , { clear = true }),
15541546 callback = function ()
1555- Async . safe_schedule (function ()
1547+ vim . schedule (function ()
15561548 M .log (' debug' , ' UIEnter triggered, installing plugins' )
15571549 M .install ()
15581550 end )
0 commit comments