fix(mason): refresh registry before installing packages
This commit is contained in:
+7
-9
@@ -155,7 +155,7 @@ function M:mason_install(on_done)
|
|||||||
local registry = require("mason-registry")
|
local registry = require("mason-registry")
|
||||||
local ok, pkg = pcall(registry.get_package, self.config.name)
|
local ok, pkg = pcall(registry.get_package, self.config.name)
|
||||||
if not ok then
|
if not ok then
|
||||||
utils.err("Could not locate package " .. self.config.name)
|
utils.err(pkg)
|
||||||
|
|
||||||
if on_done then
|
if on_done then
|
||||||
on_done(false)
|
on_done(false)
|
||||||
@@ -217,14 +217,6 @@ end
|
|||||||
--- Install package dependencies
|
--- Install package dependencies
|
||||||
---@param on_done fun(success: boolean)?
|
---@param on_done fun(success: boolean)?
|
||||||
function M:install_dependencies(on_done)
|
function M:install_dependencies(on_done)
|
||||||
if not self.dependencies or #self.dependencies == 0 then
|
|
||||||
if on_done then
|
|
||||||
on_done(true)
|
|
||||||
end
|
|
||||||
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
local total = #self.dependencies
|
local total = #self.dependencies
|
||||||
local completed = 0
|
local completed = 0
|
||||||
local all_successful = true
|
local all_successful = true
|
||||||
@@ -261,7 +253,13 @@ function M:install(on_done)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
require("mason-registry").refresh(function()
|
||||||
|
if self.dependencies and #self.dependencies ~= 0 then
|
||||||
self:install_dependencies(handle_result)
|
self:install_dependencies(handle_result)
|
||||||
|
else
|
||||||
|
self:mason_install(on_done)
|
||||||
|
end
|
||||||
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Create a new instance
|
--- Create a new instance
|
||||||
|
|||||||
Reference in New Issue
Block a user