From 7bfc159f630c4e9535587e6d3fdd63daf70f4270 Mon Sep 17 00:00:00 2001 From: Saiful Islam Date: Sun, 2 Jun 2024 06:26:01 +0600 Subject: [PATCH] fix(MasonInstallAll): mason registry refresh callback (#2867) Added refresh callback to make sure install package on first command. Right now it's not installing on first command. --- lua/nvchad/plugins/init.lua | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/lua/nvchad/plugins/init.lua b/lua/nvchad/plugins/init.lua index bac177e5..0ac67500 100644 --- a/lua/nvchad/plugins/init.lua +++ b/lua/nvchad/plugins/init.lua @@ -58,13 +58,16 @@ return { vim.api.nvim_create_user_command("MasonInstallAll", function() if opts.ensure_installed and #opts.ensure_installed > 0 then vim.cmd "Mason" + local mr = require("mason-registry") - for _, tool in ipairs(opts.ensure_installed) do - local p = require("mason-registry").get_package(tool) - if not p:is_installed() then - p:install() + mr.refresh(function() + for _, tool in ipairs(opts.ensure_installed) do + local p = mr.get_package(tool) + if not p:is_installed() then + p:install() + end end - end + end) end end, {})