From fefc91fdee4425466c27524c39a2fc20f6035294 Mon Sep 17 00:00:00 2001 From: Marc Jakobi Date: Thu, 4 Jul 2024 20:12:09 +0200 Subject: [PATCH 1/2] fix: compatibility with rocks-git.nvim Fixes #4 --- lua/rocks-lazy/internal.lua | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lua/rocks-lazy/internal.lua b/lua/rocks-lazy/internal.lua index 4cc86c0..040fb5e 100644 --- a/lua/rocks-lazy/internal.lua +++ b/lua/rocks-lazy/internal.lua @@ -9,9 +9,13 @@ function rocks_lazy.load() local user_rocks = api.get_user_rocks() local has_rocks_config, rocks_config = pcall(require, "rocks-config") - ---@type fun(name: string) | nil - local config_hook = has_rocks_config and type(rocks_config.configure) == "function" and rocks_config.configure - or nil + ---@param name string + local config_hook = function(name) + if has_rocks_config and type(rocks_config.configure) == "function" + pcall(vim.cmd.packadd, { name, bang = true }) + rocks_config.configure(name) + end + end --- HACK: For some reason, if a RockSpec contains a list --- (e.g. colorscheme = [ .. ]) then vim.deepcopy errors From dac335921a76f9ebaefcc91ed151ed77fdb9e6c9 Mon Sep 17 00:00:00 2001 From: Marc Jakobi Date: Thu, 4 Jul 2024 20:16:56 +0200 Subject: [PATCH 2/2] chore: add missing then --- lua/rocks-lazy/internal.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/rocks-lazy/internal.lua b/lua/rocks-lazy/internal.lua index 040fb5e..51fe5d9 100644 --- a/lua/rocks-lazy/internal.lua +++ b/lua/rocks-lazy/internal.lua @@ -11,7 +11,7 @@ function rocks_lazy.load() local has_rocks_config, rocks_config = pcall(require, "rocks-config") ---@param name string local config_hook = function(name) - if has_rocks_config and type(rocks_config.configure) == "function" + if has_rocks_config and type(rocks_config.configure) == "function" then pcall(vim.cmd.packadd, { name, bang = true }) rocks_config.configure(name) end