Skip to content
This repository was archived by the owner on Dec 7, 2025. It is now read-only.

Commit fa134d3

Browse files
committed
update
1 parent 8df8b85 commit fa134d3

File tree

1 file changed

+25
-25
lines changed

1 file changed

+25
-25
lines changed

lua/strive/init.lua

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@ local STATUS = {
4343
-- =====================================================================
4444
-- 2. Async Utilities
4545
-- =====================================================================
46-
local async = {}
46+
local Async = {}
4747

4848
-- Wrap a function to return a promise
49-
function async.wrap(func)
49+
function Async.wrap(func)
5050
return function(...)
5151
local args = { ... }
5252
return function(callback)
@@ -57,7 +57,7 @@ function async.wrap(func)
5757
end
5858

5959
-- Await a promise - execution is paused until promise resolves
60-
function async.await(promise)
60+
function Async.await(promise)
6161
local co = coroutine.running()
6262
if not co then
6363
error('Cannot await outside of an async function')
@@ -73,7 +73,7 @@ function async.await(promise)
7373
end
7474

7575
-- Create an async function that can use await
76-
function async.async(func)
76+
function Async.async(func)
7777
return function(...)
7878
local args = { ... }
7979
local co = coroutine.create(function()
@@ -92,7 +92,7 @@ function async.async(func)
9292
end
9393

9494
-- Run multiple promises concurrently and wait for all to complete
95-
function async.all(promises)
95+
function Async.all(promises)
9696
return function(callback)
9797
if #promises == 0 then
9898
callback({})
@@ -419,7 +419,7 @@ end
419419

420420
-- Check if plugin is installed (async version)
421421
function Plugin:is_installed()
422-
return async.wrap(function(callback)
422+
return Async.wrap(function(callback)
423423
uv.fs_stat(self:get_path(), function(err, stat)
424424
callback(not err and stat and stat.type == 'directory')
425425
end)
@@ -627,8 +627,8 @@ function Plugin:theme(name)
627627
self.colorscheme = name or self.plugin_name
628628

629629
-- If already installed, apply the theme
630-
async.async(function()
631-
local installed = async.await(self:is_installed())
630+
Async.async(function()
631+
local installed = Async.await(self:is_installed())
632632
if installed then
633633
vim.schedule(function()
634634
vim.opt.rtp:append(vim.fs.joinpath(START_DIR, self.plugin_name))
@@ -643,14 +643,14 @@ end
643643
-- Install the plugin
644644
function Plugin:install()
645645
if self.is_dev or not self.is_remote then
646-
return async.wrap(function(cb)
646+
return Async.wrap(function(cb)
647647
cb(true)
648648
end)()
649649
end
650650

651-
return async.wrap(function(callback)
651+
return Async.wrap(function(callback)
652652
-- Check if already installed
653-
local installed = async.await(self:is_installed())
653+
local installed = Async.await(self:is_installed())
654654
if installed then
655655
callback(true)
656656
return
@@ -719,14 +719,14 @@ end
719719
-- Update the plugin
720720
function Plugin:update()
721721
if self.is_dev or not self.is_remote then
722-
return async.wrap(function(cb)
722+
return Async.wrap(function(cb)
723723
cb(true)
724724
end)()
725725
end
726726

727-
return async.wrap(function(callback)
727+
return Async.wrap(function(callback)
728728
-- Check if plugin is installed
729-
local installed = async.await(self:is_installed())
729+
local installed = Async.await(self:is_installed())
730730
if not installed then
731731
callback(true)
732732
return
@@ -887,11 +887,11 @@ function M.install()
887887
local plugins_to_install = {}
888888

889889
-- Create installation tasks
890-
async.async(function()
890+
Async.async(function()
891891
-- Find plugins that need installation
892892
for _, plugin in ipairs(plugins) do
893893
if plugin.is_remote and not plugin.is_dev then
894-
local installed = async.await(plugin:is_installed())
894+
local installed = Async.await(plugin:is_installed())
895895
if not installed then
896896
table.insert(plugins_to_install, plugin)
897897
end
@@ -907,8 +907,8 @@ function M.install()
907907

908908
for _, plugin in ipairs(plugins_to_install) do
909909
task_queue:enqueue(function(done)
910-
async.async(function()
911-
async.await(plugin:install())
910+
Async.async(function()
911+
Async.await(plugin:install())
912912
done()
913913
end)()
914914
end)
@@ -934,11 +934,11 @@ function M.update()
934934
local plugins_to_update = {}
935935

936936
-- Create update tasks
937-
async.async(function()
937+
Async.async(function()
938938
-- Find plugins that need updating
939939
for _, plugin in ipairs(plugins) do
940940
if plugin.is_remote and not plugin.is_dev then
941-
local installed = async.await(plugin:is_installed())
941+
local installed = Async.await(plugin:is_installed())
942942
if installed then
943943
table.insert(plugins_to_update, plugin)
944944
end
@@ -954,8 +954,8 @@ function M.update()
954954

955955
for _, plugin in ipairs(plugins_to_update) do
956956
task_queue:enqueue(function(done)
957-
async.async(function()
958-
async.await(plugin:update())
957+
Async.async(function()
958+
Async.await(plugin:update())
959959
done()
960960
end)()
961961
end)
@@ -975,10 +975,10 @@ end
975975

976976
-- Load all installed plugins
977977
function M.load_all()
978-
async.async(function()
978+
Async.async(function()
979979
for _, plugin in ipairs(plugins) do
980980
if not plugin.is_lazy then
981-
local installed = async.await(plugin:is_installed())
981+
local installed = Async.await(plugin:is_installed())
982982
if installed then
983983
plugin:load()
984984
end
@@ -1038,7 +1038,7 @@ function M.clean()
10381038
M.log('info', string.format('Removing %s', path))
10391039

10401040
-- Use async version of delete
1041-
async.async(function()
1041+
Async.async(function()
10421042
vim.fn.delete(path, 'rf')
10431043
end)()
10441044
end

0 commit comments

Comments
 (0)