Use mason-tool-installer to install packages for conform
This commit is contained in:
parent
e795252784
commit
fbf30c9325
|
@ -2,9 +2,6 @@
|
|||
local slow_format_filetypes = {}
|
||||
return {
|
||||
"stevearc/conform.nvim",
|
||||
dependencies = {
|
||||
"williamboman/mason.nvim",
|
||||
},
|
||||
event = { "BufWritePre" },
|
||||
cmd = { "ConformInfo" },
|
||||
keys = {
|
||||
|
|
|
@ -4,6 +4,7 @@ return {
|
|||
dependencies = {
|
||||
{ "mason-org/mason.nvim", opts = {} },
|
||||
"mason-org/mason-lspconfig.nvim",
|
||||
"zapling/mason-conform.nvim",
|
||||
},
|
||||
config = function()
|
||||
local lsp = require("tools.lsp")
|
||||
|
@ -22,9 +23,29 @@ return {
|
|||
return nil
|
||||
end, lsp))
|
||||
|
||||
local formatters_by_ft = require("conform").formatters_by_ft
|
||||
local mapping = require("mason-conform.mapping")
|
||||
local formatters = vim.iter(formatters_by_ft)
|
||||
:filter(function(formatters)
|
||||
return type(formatters) ~= "function"
|
||||
end)
|
||||
:map(function(_, formatters)
|
||||
return formatters
|
||||
end)
|
||||
:totable()
|
||||
vim.iter(formatters)
|
||||
:flatten()
|
||||
:map(function(formatter)
|
||||
return mapping.conform_to_package[formatter]
|
||||
end)
|
||||
:each(function(package)
|
||||
table.insert(ensure_installed, package)
|
||||
end)
|
||||
|
||||
require("mason-tool-installer").setup({
|
||||
ensure_installed = ensure_installed,
|
||||
auto_update = true,
|
||||
debounde_hours = 24,
|
||||
})
|
||||
end,
|
||||
},
|
||||
|
@ -36,12 +57,4 @@ return {
|
|||
"neovim/nvim-lspconfig",
|
||||
},
|
||||
},
|
||||
{
|
||||
"zapling/mason-conform.nvim",
|
||||
opts = {},
|
||||
dependencies = {
|
||||
{ "mason-org/mason.nvim", opts = {} },
|
||||
"stevearc/conform.nvim",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user