diff --git a/lua/mason-core/managers/pip3/init.lua b/lua/mason-core/managers/pip3/init.lua index ace0b7dba..4581bc0bf 100644 --- a/lua/mason-core/managers/pip3/init.lua +++ b/lua/mason-core/managers/pip3/init.lua @@ -1,4 +1,5 @@ local _ = require "mason-core.functional" +local a = require "mason-core.async" local settings = require "mason.settings" local path = require "mason-core.path" local platform = require "mason-core.platform" @@ -44,8 +45,13 @@ function M.install(packages) pkgs[1] = ("%s==%s"):format(pkgs[1], version) end) - local executables = platform.is.win and _.list_not_nil(vim.g.python3_host_prog, "python", "python3") - or _.list_not_nil(vim.g.python3_host_prog, "python3", "python") + if vim.in_fast_event() then + a.scheduler() + end + + local executables = platform.is.win + and _.list_not_nil(vim.g.python3_host_prog and vim.fn.expand(vim.g.python3_host_prog), "python", "python3") + or _.list_not_nil(vim.g.python3_host_prog and vim.fn.expand(vim.g.python3_host_prog), "python3", "python") -- pip3 will hardcode the full path to venv executables, so we need to promote cwd to make sure pip uses the final destination path. ctx:promote_cwd() diff --git a/lua/mason-registry/goimports-reviser/init.lua b/lua/mason-registry/goimports-reviser/init.lua index 3ac343e95..978dafc53 100644 --- a/lua/mason-registry/goimports-reviser/init.lua +++ b/lua/mason-registry/goimports-reviser/init.lua @@ -13,5 +13,5 @@ return Pkg.new { homepage = "https://pkg.go.dev/github.com/incu6us/goimports-reviser", categories = { Pkg.Cat.Formatter }, languages = { Pkg.Lang.Go }, - install = go.packages { "github.com/incu6us/goimports-reviser", bin = { "goimports-reviser" } }, + install = go.packages { "github.com/incu6us/goimports-reviser/v3", bin = { "goimports-reviser" } }, } diff --git a/lua/mason/health/init.lua b/lua/mason/health/init.lua index 342015f1f..727bae325 100644 --- a/lua/mason/health/init.lua +++ b/lua/mason/health/init.lua @@ -242,7 +242,12 @@ function M.check() if vim.g.python3_host_prog then table.insert( checks, - check { cmd = vim.g.python3_host_prog, args = { "--version" }, name = "python3_host_prog", relaxed = true } + check { + cmd = vim.fn.expand(vim.g.python3_host_prog), + args = { "--version" }, + name = "python3_host_prog", + relaxed = true, + } ) end diff --git a/tests/mason-core/managers/pip3_spec.lua b/tests/mason-core/managers/pip3_spec.lua index 0d78d7089..6f78cdb42 100644 --- a/tests/mason-core/managers/pip3_spec.lua +++ b/tests/mason-core/managers/pip3_spec.lua @@ -2,6 +2,7 @@ local mock = require "luassert.mock" local spy = require "luassert.spy" local path = require "mason-core.path" +local a = require "mason-core.async" local pip3 = require "mason-core.managers.pip3" local installer = require "mason-core.installer" local Result = require "mason-core.result" @@ -86,6 +87,22 @@ describe("pip3 manager", function() end) ) + it( + "should expand python3_host_prog path", + async_test(function() + vim.g.python3_host_prog = "~/python3" + local handle = InstallHandleGenerator "dummy" + local ctx = InstallContextGenerator(handle) + ctx.spawn.python = spy.new(mockx.returns {}) + ctx.spawn[vim.env.HOME .. "/python3"] = spy.new(mockx.returns {}) + + installer.run_installer(ctx, pip3.packages { "package" }) + a.scheduler() + vim.g.python3_host_prog = nil + assert.spy(ctx.spawn[vim.env.HOME .. "/python3"]).was_called(1) + end) + ) + it( "should use install_args from settings", async_test(function()