From 43f33ba1ba81fa3864f8683b1157efa099f8c9bc Mon Sep 17 00:00:00 2001 From: Jay Patel <36803168+jay-babu@users.noreply.github.com> Date: Tue, 21 Mar 2023 21:59:01 -0400 Subject: [PATCH] feat: refresh registry before installing servers in ensure_installed https://github.com/williamboman/mason-lspconfig.nvim/pull/170/files --- lua/mason-null-ls/ensure_installed.lua | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lua/mason-null-ls/ensure_installed.lua b/lua/mason-null-ls/ensure_installed.lua index 1b73d44..7bcd3e9 100644 --- a/lua/mason-null-ls/ensure_installed.lua +++ b/lua/mason-null-ls/ensure_installed.lua @@ -1,4 +1,5 @@ local settings = require('mason-null-ls.settings') +local registry = require('mason-registry') ---@param null_ls_source_name string local function resolve_package(null_ls_source_name) @@ -17,7 +18,7 @@ local function resolve_package(null_ls_source_name) end) end -return function() +local function ensure_installed() for _, source_identifier in ipairs(settings.current.ensure_installed) do local Package = require('mason-core.package') @@ -42,3 +43,11 @@ return function() ) end end + +if registry.refresh then + return function() + registry.refresh(vim.schedule_wrap(ensure_installed)) + end +else + return ensure_installed +end