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 = {}
|
local slow_format_filetypes = {}
|
||||||
return {
|
return {
|
||||||
"stevearc/conform.nvim",
|
"stevearc/conform.nvim",
|
||||||
dependencies = {
|
|
||||||
"williamboman/mason.nvim",
|
|
||||||
},
|
|
||||||
event = { "BufWritePre" },
|
event = { "BufWritePre" },
|
||||||
cmd = { "ConformInfo" },
|
cmd = { "ConformInfo" },
|
||||||
keys = {
|
keys = {
|
||||||
|
|
|
@ -4,6 +4,7 @@ return {
|
||||||
dependencies = {
|
dependencies = {
|
||||||
{ "mason-org/mason.nvim", opts = {} },
|
{ "mason-org/mason.nvim", opts = {} },
|
||||||
"mason-org/mason-lspconfig.nvim",
|
"mason-org/mason-lspconfig.nvim",
|
||||||
|
"zapling/mason-conform.nvim",
|
||||||
},
|
},
|
||||||
config = function()
|
config = function()
|
||||||
local lsp = require("tools.lsp")
|
local lsp = require("tools.lsp")
|
||||||
|
@ -22,9 +23,29 @@ return {
|
||||||
return nil
|
return nil
|
||||||
end, lsp))
|
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({
|
require("mason-tool-installer").setup({
|
||||||
ensure_installed = ensure_installed,
|
ensure_installed = ensure_installed,
|
||||||
auto_update = true,
|
auto_update = true,
|
||||||
|
debounde_hours = 24,
|
||||||
})
|
})
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
@ -36,12 +57,4 @@ return {
|
||||||
"neovim/nvim-lspconfig",
|
"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