Skip to content

Commit

Permalink
feat: refresh registry before installing servers in ensure_installed
Browse files Browse the repository at this point in the history
  • Loading branch information
jay-babu committed Mar 27, 2023
1 parent 35ce897 commit 43f33ba
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion lua/mason-null-ls/ensure_installed.lua
Original file line number Diff line number Diff line change
@@ -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)
Expand All @@ -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')

Expand All @@ -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

0 comments on commit 43f33ba

Please sign in to comment.