mirror of
https://github.com/LazyVim/LazyVim.git
synced 2025-06-23 09:18:51 +02:00
refactor(mason): move ensure_installed to opts.ensure_installed
This commit is contained in:
parent
77b5e9ab56
commit
814c43a053
1 changed files with 13 additions and 8 deletions
|
@ -114,17 +114,22 @@ return {
|
|||
"williamboman/mason.nvim",
|
||||
cmd = "Mason",
|
||||
keys = { { "<leader>cm", "<cmd>Mason<cr>", desc = "Mason" } },
|
||||
ensure_installed = {
|
||||
"stylua",
|
||||
"shellcheck",
|
||||
"shfmt",
|
||||
"flake8",
|
||||
opts = {
|
||||
ensure_installed = {
|
||||
"stylua",
|
||||
"shellcheck",
|
||||
"shfmt",
|
||||
"flake8",
|
||||
},
|
||||
},
|
||||
---@param opts MasonSettings
|
||||
config = function(self, opts)
|
||||
---@param opts MasonSettings | {ensure_installed: string[]}
|
||||
config = function(plugin, opts)
|
||||
if plugin.ensure_installed then
|
||||
require("lazyvim.util").deprecate("treesitter.ensure_installed", "treesitter.opts.ensure_installed")
|
||||
end
|
||||
require("mason").setup(opts)
|
||||
local mr = require("mason-registry")
|
||||
for _, tool in ipairs(self.ensure_installed) do
|
||||
for _, tool in ipairs(opts.ensure_installed) do
|
||||
local p = mr.get_package(tool)
|
||||
if not p:is_installed() then
|
||||
p:install()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue