feat: Add config opt 'ignore_install'

This option allows the caller to define a list of conform formatters
that should be ignored during the install process. This might be useful
if the caller already have this tools installed and prefer not to have
them downloaded again by mason.
This commit is contained in:
Andreas Palm
2024-05-19 13:22:23 +02:00
parent 3ba75eeae8
commit 882a4449e5
3 changed files with 21 additions and 3 deletions
+8
View File
@@ -2,6 +2,7 @@ local registry = require("mason-registry")
local mapping = require("mason-conform.mapping")
local function auto_install()
local config = require("mason-conform").config
local formatters_by_ft = require("conform").formatters_by_ft;
local formatters_to_install = {}
@@ -19,6 +20,13 @@ local function auto_install()
end
end
-- Filter out formatters that the user wants to ignore
for _, formatter_to_ignore in pairs(config.ignore_install) do
formatters_to_install[formatter_to_ignore] = nil
end
print(vim.inspect(formatters_to_install))
for conformFormatter, _ in pairs(formatters_to_install) do
local package = mapping.conform_to_package[conformFormatter]
if package ~= nil then