feat: skip mason pkg install if already present

This commit is contained in:
Tomas Mirchev 2025-10-26 03:05:28 +03:00
parent e07337d3ed
commit 63e81da490

View File

@ -234,21 +234,29 @@ function M.mason_install()
local result = utils.await(function(resolve) local result = utils.await(function(resolve)
for _, name in ipairs(packages) do for _, name in ipairs(packages) do
print('Mason package installing: ' .. name)
local pkg = registry.get_package(name) local pkg = registry.get_package(name)
pkg:install({}, function(success, error) if pkg:is_installed() then
if success then print('Mason package already installed: ' .. name)
print('Mason package installed: ' .. name)
else
print('Mason package failed: ' .. name)
print(' > Error: ' .. vim.inspect(error))
end
pending = pending - 1 pending = pending - 1
if pending == 0 then if pending == 0 then
resolve(true) resolve(true)
end end
end) else
print('Mason package installing: ' .. name)
pkg:install({}, function(success, error)
if success then
print('Mason package installed: ' .. name)
else
print('Mason package failed: ' .. name)
print(' > Error: ' .. vim.inspect(error))
end
pending = pending - 1
if pending == 0 then
resolve(true)
end
end)
end
end end
end, 5 * 60 * 1000, 200) end, 5 * 60 * 1000, 200)