diff options
Diffstat (limited to 'lua/nvim-lsp-installer/core')
| -rw-r--r-- | lua/nvim-lsp-installer/core/managers/luarocks/init.lua | 13 | ||||
| -rw-r--r-- | lua/nvim-lsp-installer/core/spawn.lua | 2 |
2 files changed, 9 insertions, 6 deletions
diff --git a/lua/nvim-lsp-installer/core/managers/luarocks/init.lua b/lua/nvim-lsp-installer/core/managers/luarocks/init.lua index 4e18af2b..e25c92a2 100644 --- a/lua/nvim-lsp-installer/core/managers/luarocks/init.lua +++ b/lua/nvim-lsp-installer/core/managers/luarocks/init.lua @@ -1,6 +1,5 @@ local installer = require "nvim-lsp-installer.core.installer" local _ = require "nvim-lsp-installer.core.functional" -local std = require "nvim-lsp-installer.core.managers.std" local process = require "nvim-lsp-installer.core.process" local path = require "nvim-lsp-installer.core.path" local Result = require "nvim-lsp-installer.core.result" @@ -18,23 +17,25 @@ local function with_receipt(package) end ---@param package string @The luarock package to install. -function M.package(package) +---@param opts {dev: boolean}|nil +function M.package(package, opts) return function() - return M.install(package).with_receipt() + return M.install(package, opts).with_receipt() end end ---@async ---@param package string @The luarock package to install. -function M.install(package) - std.ensure_executable("luarocks", { help_url = "https://luarocks.org/" }) +---@param opts {dev: boolean}|nil +function M.install(package, opts) + opts = opts or {} local ctx = installer.context() ctx:promote_cwd() ctx.spawn.luarocks { "install", - "--dev", "--tree", ctx.cwd:get(), + opts.dev and "--dev" or vim.NIL, package, ctx.requested_version:or_else(vim.NIL), } diff --git a/lua/nvim-lsp-installer/core/spawn.lua b/lua/nvim-lsp-installer/core/spawn.lua index 764468f9..812848c3 100644 --- a/lua/nvim-lsp-installer/core/spawn.lua +++ b/lua/nvim-lsp-installer/core/spawn.lua @@ -12,6 +12,8 @@ local spawn = { gem = platform.is_win and "gem.cmd" or "gem", composer = platform.is_win and "composer.bat" or "composer", gradlew = platform.is_win and "gradlew.bat" or "gradlew", + -- for hererocks installations + luarocks = (platform.is_win and vim.fn.executable "luarocks.bat" == 1) and "luarocks.bat" or "luarocks", }, } |
