aboutsummaryrefslogtreecommitdiffstats
path: root/lua/nvim-lsp-installer/installers/pip3.lua
diff options
context:
space:
mode:
Diffstat (limited to 'lua/nvim-lsp-installer/installers/pip3.lua')
-rw-r--r--lua/nvim-lsp-installer/installers/pip3.lua6
1 files changed, 6 insertions, 0 deletions
diff --git a/lua/nvim-lsp-installer/installers/pip3.lua b/lua/nvim-lsp-installer/installers/pip3.lua
index 8ae3d2db..6b593858 100644
--- a/lua/nvim-lsp-installer/installers/pip3.lua
+++ b/lua/nvim-lsp-installer/installers/pip3.lua
@@ -10,6 +10,8 @@ local M = {}
local REL_INSTALL_DIR = "venv"
+---@param python_executable string
+---@param packages string[]
local function create_installer(python_executable, packages)
return installers.pipe {
std.ensure_executables {
@@ -18,6 +20,7 @@ local function create_installer(python_executable, packages)
("%s was not found in path. Refer to https://www.python.org/downloads/."):format(python_executable),
},
},
+ ---@type ServerInstallerFunction
function(server, callback, context)
local pkgs = Data.list_copy(packages or {})
local c = process.chain {
@@ -40,12 +43,15 @@ local function create_installer(python_executable, packages)
}
end
+---@param packages string[] @The pip 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)
local py3 = create_installer("python3", packages)
local py = create_installer("python", packages)
return installers.first_successful(platform.is_win and { py, py3 } or { py3, py }) -- see https://github.com/williamboman/nvim-lsp-installer/issues/128
end
+---@param root_dir string @The directory to resolve the executable from.
+---@param executable string
function M.executable(root_dir, executable)
return path.concat { root_dir, REL_INSTALL_DIR, platform.is_win and "Scripts" or "bin", executable }
end