aboutsummaryrefslogtreecommitdiffstats
path: root/lua/nvim-lsp-installer/installers
diff options
context:
space:
mode:
authorWilliam Boman <william@redwill.se>2021-12-07 20:15:03 +0100
committerGitHub <noreply@github.com>2021-12-07 20:15:03 +0100
commit0fe8c254d90794f13860cbeac5e5987a081a8031 (patch)
treeb3a7c9239278baaaefa4274955f910adbb2ced94 /lua/nvim-lsp-installer/installers
parentfix(installers/npm): dont apply global-style for standalone npm install (diff)
downloadmason-0fe8c254d90794f13860cbeac5e5987a081a8031.tar
mason-0fe8c254d90794f13860cbeac5e5987a081a8031.tar.gz
mason-0fe8c254d90794f13860cbeac5e5987a081a8031.tar.bz2
mason-0fe8c254d90794f13860cbeac5e5987a081a8031.tar.lz
mason-0fe8c254d90794f13860cbeac5e5987a081a8031.tar.xz
mason-0fe8c254d90794f13860cbeac5e5987a081a8031.tar.zst
mason-0fe8c254d90794f13860cbeac5e5987a081a8031.zip
initial healthcheck integration (#321)
Diffstat (limited to 'lua/nvim-lsp-installer/installers')
-rw-r--r--lua/nvim-lsp-installer/installers/composer.lua16
-rw-r--r--lua/nvim-lsp-installer/installers/gem.lua4
-rw-r--r--lua/nvim-lsp-installer/installers/init.lua1
-rw-r--r--lua/nvim-lsp-installer/installers/npm.lua8
-rw-r--r--lua/nvim-lsp-installer/installers/pip3.lua2
5 files changed, 16 insertions, 15 deletions
diff --git a/lua/nvim-lsp-installer/installers/composer.lua b/lua/nvim-lsp-installer/installers/composer.lua
index a046575b..efb5038f 100644
--- a/lua/nvim-lsp-installer/installers/composer.lua
+++ b/lua/nvim-lsp-installer/installers/composer.lua
@@ -6,21 +6,21 @@ local std = require "nvim-lsp-installer.installers.std"
local platform = require "nvim-lsp-installer.platform"
local process = require "nvim-lsp-installer.process"
-local composer = platform.is_win and "composer.bat" or "composer"
+local M = {}
+
+M.composer_cmd = platform.is_win and "composer.bat" or "composer"
---@param installer ServerInstallerFunction
local function ensure_composer(installer)
return installers.pipe {
std.ensure_executables {
{ "php", "php was not found in path. Refer to https://www.php.net/." },
- { composer, "composer was not found in path. Refer to https://getcomposer.org/download/." },
+ { M.composer_cmd, "composer was not found in path. Refer to https://getcomposer.org/download/." },
},
installer,
}
end
-local M = {}
-
---@param packages string[] @The Gem packages to install. The first item in this list will be the recipient of the server version, should the user request a specific one.
function M.packages(packages)
return ensure_composer(
@@ -32,8 +32,8 @@ function M.packages(packages)
}
if not (fs.file_exists(path.concat { context.install_dir, "composer.json" })) then
- c.run(composer, { "init", "--no-interaction", "--stability=dev" })
- c.run(composer, { "config", "prefer-stable", "true" })
+ c.run(M.composer_cmd, { "init", "--no-interaction", "--stability=dev" })
+ c.run(M.composer_cmd, { "config", "prefer-stable", "true" })
end
local pkgs = Data.list_copy(packages or {})
@@ -42,7 +42,7 @@ function M.packages(packages)
pkgs[1] = ("%s:%s"):format(pkgs[1], context.requested_server_version)
end
- c.run(composer, vim.list_extend({ "require" }, pkgs))
+ c.run(M.composer_cmd, vim.list_extend({ "require" }, pkgs))
c.spawn(callback)
end
)
@@ -52,7 +52,7 @@ function M.install()
return ensure_composer(
---@type ServerInstallerFunction
function(_, callback, context)
- process.spawn(composer, {
+ process.spawn(M.composer_cmd, {
args = {
"install",
"--no-interaction",
diff --git a/lua/nvim-lsp-installer/installers/gem.lua b/lua/nvim-lsp-installer/installers/gem.lua
index 727af496..a2e3945f 100644
--- a/lua/nvim-lsp-installer/installers/gem.lua
+++ b/lua/nvim-lsp-installer/installers/gem.lua
@@ -7,7 +7,7 @@ local platform = require "nvim-lsp-installer.platform"
local M = {}
-local gem = platform.is_win and "gem.cmd" or "gem"
+M.gem_cmd = platform.is_win and "gem.cmd" or "gem"
---@param packages string[] @The Gem packages to install. The first item in this list will be the recipient of the server version, should the user request a specific one.
function M.packages(packages)
@@ -24,7 +24,7 @@ function M.packages(packages)
pkgs[1] = ("%s:%s"):format(pkgs[1], context.requested_server_version)
end
- process.spawn(gem, {
+ process.spawn(M.gem_cmd, {
args = {
"install",
"--no-user-install",
diff --git a/lua/nvim-lsp-installer/installers/init.lua b/lua/nvim-lsp-installer/installers/init.lua
index a04eeafb..25d97658 100644
--- a/lua/nvim-lsp-installer/installers/init.lua
+++ b/lua/nvim-lsp-installer/installers/init.lua
@@ -1,6 +1,7 @@
local platform = require "nvim-lsp-installer.platform"
local log = require "nvim-lsp-installer.log"
local Data = require "nvim-lsp-installer.data"
+local process = require "nvim-lsp-installer.process"
local fs = require "nvim-lsp-installer.fs"
local path = require "nvim-lsp-installer.path"
diff --git a/lua/nvim-lsp-installer/installers/npm.lua b/lua/nvim-lsp-installer/installers/npm.lua
index b695a9b2..b0ae52eb 100644
--- a/lua/nvim-lsp-installer/installers/npm.lua
+++ b/lua/nvim-lsp-installer/installers/npm.lua
@@ -10,7 +10,7 @@ local list_copy = Data.list_copy
local M = {}
-local npm = platform.is_win and "npm.cmd" or "npm"
+M.npm_command = platform.is_win and "npm.cmd" or "npm"
---@param installer ServerInstallerFunction
local function ensure_npm(installer)
@@ -56,7 +56,7 @@ local function create_installer(standalone)
fs.file_exists(path.concat { ctx.install_dir, "package.json" }))
then
-- Create a package.json to set a boundary for where npm installs packages.
- c.run(npm, { "init", "--yes", "--scope=lsp-installer" })
+ c.run(M.npm_command, { "init", "--yes", "--scope=lsp-installer" })
end
if not standalone and ctx.requested_server_version and #pkgs > 0 then
@@ -65,7 +65,7 @@ local function create_installer(standalone)
end
-- stylua: ignore end
- c.run(npm, vim.list_extend({ "install" }, pkgs))
+ c.run(M.npm_command, vim.list_extend({ "install" }, pkgs))
c.spawn(callback)
end
)
@@ -99,7 +99,7 @@ function M.run(script)
return ensure_npm(
---@type ServerInstallerFunction
function(_, callback, ctx)
- process.spawn(npm, {
+ process.spawn(M.npm_command, {
args = { "run", script },
cwd = ctx.install_dir,
stdio_sink = ctx.stdio_sink,
diff --git a/lua/nvim-lsp-installer/installers/pip3.lua b/lua/nvim-lsp-installer/installers/pip3.lua
index 4282bcc8..234aad98 100644
--- a/lua/nvim-lsp-installer/installers/pip3.lua
+++ b/lua/nvim-lsp-installer/installers/pip3.lua
@@ -54,7 +54,7 @@ function M.packages(packages)
local py3_host_prog = vim.g.python3_host_prog
if py3_host_prog then
- log.fmt_debug("Found python3_host_prog (%s)", py3_host_prog)
+ log.fmt_trace("Found python3_host_prog (%s)", py3_host_prog)
table.insert(installer_variants, 1, create_installer(py3_host_prog, packages))
end