theHamsta / nvim_rocks

:metal: Install luarocks packages for Neovim's built-in Lua interpreter.
44 stars 6 forks source link

ensure_installed reinstalls upon every nvim load #6

Open andrewcrook opened 6 months ago

andrewcrook commented 6 months ago

ensure_installed reinstalls packages upon every nvim load

Example every nvim reload it says its trying to install luafilesystem

luafilesystem 1.8.0-1 is now installed in ...re/nvim/lazy/nvim_rocks (license: MIT/X11)

I can tell its doing this because the date changes on the directory after every reload

 ~/.local/share/nvim/lazy/nvim_rocks/lib/luarocks/rocks-5.1/luafilesystem/1.8.0-1

here is the current config

config = function()
      ---- Add here the packages you want to make sure that they are installed
      local nvim_rocks = require "nvim_rocks"
      nvim_rocks.ensure_installed {"LuaFileSystem"}
    end,
andrewcrook commented 6 months ago

Seems that the issue is caused by case mismatch. I am not sure about the lua/luarocks specifications regarding package naming. Maybe ensure and convert the value given to has_value is the same case that the string is being compared against ? For example ...

local function has_value(tab, val)
     valLower = string.lower(val)
    for _, value in ipairs(tab) do
         valueLower = string.lower(value) -- needed? is it alway lower case?
        if valueLower == valLower then
            return true
        end
    end

    return false
end
andrewcrook commented 1 week ago

I think nvim_rocks.ensure_installedshould probably turn all strings lower case. This gets rid of the issue.