Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(sync): [regression] load rocks.nvim modules before trying to use them #610

Merged
merged 1 commit into from
Dec 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 23 additions & 12 deletions lua/rocks/operations/sync.lua
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,28 @@ operations.sync = function(user_rocks, on_complete)
callback(report_progress, report_error, helpers.manage_rock_stub)
end

adapter.synchronise_site_symlinks()

vim
.iter(sync_status.to_install)
---@param rock_name string
:map(function(rock_name)
return user_rocks[rock_name]
end)
---@param rock_spec RockSpec
:filter(function(rock_spec)
return not vim
.iter(skipped_rocks)
---@param skipped_rock SyncSkippedRock
:any(function(skipped_rock)
return skipped_rock.spec.name == rock_spec.name
and skipped_rock.spec.version == rock_spec.version
end)
end)
:each(function(rock_spec)
helpers.dynamic_load(rock_spec).wait()
end)

-- rocks.nvim sync handlers should be installed now.
-- try installing any rocks that rocks.nvim could not handle itself
for _, skipped_rock in ipairs(skipped_rocks) do
Expand All @@ -146,6 +168,7 @@ operations.sync = function(user_rocks, on_complete)
local callback = handlers.get_sync_handler_callback(spec)
if callback then
callback(report_progress, report_error, helpers.manage_rock_stub)
helpers.dynamic_load(spec).wait()
else
report_error(("Failed to install %s: %s"):format(spec.name, skipped_rock.reason))
end
Expand Down Expand Up @@ -250,18 +273,6 @@ operations.sync = function(user_rocks, on_complete)
refresh_rocks_state()
until vim.tbl_isempty(prunable_rocks)

adapter.synchronise_site_symlinks()

vim
.iter(sync_status.to_install)
---@param rock_name string
:map(function(rock_name)
return user_rocks[rock_name]
end)
:each(function(rock_spec)
helpers.dynamic_load(rock_spec).wait()
end)

helpers.postInstall()
if not vim.tbl_isempty(error_handles) then
local message = "Sync completed with errors! Run ':Rocks log' for details."
Expand Down
Loading