aboutsummaryrefslogtreecommitdiffstats
path: root/lua
diff options
context:
space:
mode:
Diffstat (limited to 'lua')
-rw-r--r--lua/nvim-lsp-installer/core/managers/luarocks/init.lua13
-rw-r--r--lua/nvim-lsp-installer/core/spawn.lua2
-rw-r--r--lua/nvim-lsp-installer/health/init.lua14
-rw-r--r--lua/nvim-lsp-installer/servers/teal_ls/init.lua2
4 files changed, 23 insertions, 8 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",
},
}
diff --git a/lua/nvim-lsp-installer/health/init.lua b/lua/nvim-lsp-installer/health/init.lua
index 3de797bd..e5ce40f1 100644
--- a/lua/nvim-lsp-installer/health/init.lua
+++ b/lua/nvim-lsp-installer/health/init.lua
@@ -152,7 +152,19 @@ function M.check()
end,
},
check { cmd = "cargo", args = { "--version" }, name = "cargo", relaxed = true },
- check { cmd = "luarocks", args = { "--version" }, name = "luarocks", relaxed = true },
+ check {
+ cmd = "luarocks",
+ args = { "--version" },
+ name = "luarocks",
+ relaxed = true,
+ version_check = function(version)
+ local _, _, major = version:find "(%d+)%.(%d)%.(%d)"
+ if not (tonumber(major) >= 3) then
+ -- Because of usage of "--dev" flag
+ return "Luarocks version must be >= 3.0.0."
+ end
+ end,
+ },
check { cmd = "ruby", args = { "--version" }, name = "Ruby", relaxed = true },
check { cmd = "gem", args = { "--version" }, name = "RubyGem", relaxed = true },
check { cmd = "composer", args = { "--version" }, name = "Composer", relaxed = true },
diff --git a/lua/nvim-lsp-installer/servers/teal_ls/init.lua b/lua/nvim-lsp-installer/servers/teal_ls/init.lua
index 0f372639..e1406355 100644
--- a/lua/nvim-lsp-installer/servers/teal_ls/init.lua
+++ b/lua/nvim-lsp-installer/servers/teal_ls/init.lua
@@ -7,7 +7,7 @@ return function(name, root_dir)
root_dir = root_dir,
languages = { "teal" },
homepage = "https://github.com/teal-language/teal-language-server",
- installer = luarocks.package "teal-language-server",
+ installer = luarocks.package("teal-language-server", { dev = true }),
default_options = {
cmd_env = luarocks.env(root_dir),
},