From 35d4b08d60c17b79f8e16e9e66f0d7693c99d612 Mon Sep 17 00:00:00 2001 From: Tyler Fox Date: Thu, 11 Nov 2021 12:48:01 -0800 Subject: installers/pip3: prioritize g:python3_host_prog if defined Co-authored-by: William Boman --- lua/nvim-lsp-installer/installers/pip3.lua | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'lua') diff --git a/lua/nvim-lsp-installer/installers/pip3.lua b/lua/nvim-lsp-installer/installers/pip3.lua index c8586eb3..b0eb4611 100644 --- a/lua/nvim-lsp-installer/installers/pip3.lua +++ b/lua/nvim-lsp-installer/installers/pip3.lua @@ -6,6 +6,7 @@ local platform = require "nvim-lsp-installer.platform" local process = require "nvim-lsp-installer.process" local settings = require "nvim-lsp-installer.settings" local context = require "nvim-lsp-installer.installers.context" +local log = require "nvim-lsp-installer.log" local M = {} @@ -48,9 +49,18 @@ end function M.packages(packages) local py3 = create_installer("python3", packages) local py = create_installer("python", packages) + -- see https://github.com/williamboman/nvim-lsp-installer/issues/128 + local installer_variants = platform.is_win and { py, py3 } or { py3, py } + + 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) + table.insert(installer_variants, 1, create_installer(py3_host_prog, packages)) + end + return installers.pipe { context.promote_install_dir(), - installers.first_successful(platform.is_win and { py, py3 } or { py3, py }), -- see https://github.com/williamboman/nvim-lsp-installer/issues/128 + installers.first_successful(installer_variants), } end -- cgit v1.2.3-70-g09d2