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: attempt to concatenate field version (a nil value) on install #581

Merged
merged 1 commit into from
Nov 1, 2024
Merged
Show file tree
Hide file tree
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
4 changes: 4 additions & 0 deletions lua/rocks/adapter.lua
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,10 @@ end
---@param rock RockSpec | Rock
---@return boolean created
function adapter.init_site_symlink_sync(rock)
if not rock.version then
log.info("Cannot init site symlink without rock version")
return false
end
local rock_dir = get_rock_dir(rock)
local handle = vim.uv.fs_scandir(rock_dir)
while handle do
Expand Down
18 changes: 10 additions & 8 deletions lua/rocks/operations/helpers/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -154,14 +154,16 @@ function helpers.dynamic_load(rock_spec)
end
nio.run(function()
vim.schedule(function()
if rock_spec.opt then
-- Add rock to the rtp, but don't source any scripts
log.trace(("Adding %s to the runtimepath"):format(rock_spec.name))
runtime.packadd(rock_spec, { bang = true })
else
log.trace(("Sourcing %s"):format(rock_spec.name))
runtime.packadd(rock_spec)
end
pcall(function()
if rock_spec.opt then
-- Add rock to the rtp, but don't source any scripts
log.trace(("Adding %s to the runtimepath"):format(rock_spec.name))
runtime.packadd(rock_spec, { bang = true })
else
log.trace(("Sourcing %s"):format(rock_spec.name))
runtime.packadd(rock_spec)
end
end)
future.set(true)
end)
end)
Expand Down
6 changes: 5 additions & 1 deletion lua/rocks/runtime.lua
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,11 @@ function runtime.packadd(rock_spec, opts)
opts = vim.tbl_deep_extend("force", {
bang = false,
}, opts or {})
if not adapter.has_site_symlink(rock_spec) and not adapter.init_site_symlink_sync(rock_spec) then
if
rock_spec.version
and not adapter.has_site_symlink(rock_spec)
and not adapter.init_site_symlink_sync(rock_spec)
then
log.warn(("Rock %s does not appear to be installed."):format(rock_spec.name))
return false
end
Expand Down
Loading