perf(markdown): only run markdownlint-cli2 formatter when there are markdownlint diagnostics for the buffer

This commit is contained in:
Folke Lemaitre
2024-06-30 11:16:10 +02:00
parent 06d2749308
commit 8a6875ab3b

View File

@ -24,6 +24,14 @@ return {
end
end,
},
["markdownlint-cli2"] = {
condition = function(_, ctx)
local diag = vim.tbl_filter(function(d)
return d.source == "markdownlint"
end, vim.diagnostic.get(ctx.buf))
return #diag > 0
end,
},
},
formatters_by_ft = {
["markdown"] = { "prettier", "markdownlint-cli2", "markdown-toc" },