From 63e81da4900d6a7214fefc698a0d3c546a03626b Mon Sep 17 00:00:00 2001 From: Tomas Mirchev Date: Sun, 26 Oct 2025 03:05:28 +0300 Subject: [PATCH] feat: skip mason pkg install if already present --- lua/plugins/language-manager.lua | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/lua/plugins/language-manager.lua b/lua/plugins/language-manager.lua index aefee8b..a608daa 100644 --- a/lua/plugins/language-manager.lua +++ b/lua/plugins/language-manager.lua @@ -234,21 +234,29 @@ function M.mason_install() local result = utils.await(function(resolve) for _, name in ipairs(packages) do - print('Mason package installing: ' .. name) local pkg = registry.get_package(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 - + if pkg:is_installed() then + print('Mason package already installed: ' .. name) pending = pending - 1 if pending == 0 then resolve(true) 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, 5 * 60 * 1000, 200)