question: How can I configure Conform so that the next formatter gets used when the first one's failed.
Did you check existing requests?
- [X] I have searched the existing issues
Describe the feature
Hello everyone. First of all thank you for this great library. I have a little question where I setup eslint_d and biome_check as the formatter for typescript language. The config looks like this.
local options = {
log_level = vim.log.levels.DEBUG,
formatters_by_ft = {
lua = { "stylua" },
go = { "gofmt" },
typescript = { { "eslint_d", "biome-check" } },
}.
}
require("conform").setup(options)
In my work project that we use eslint as the formatter, everything works fine. but when I work on my personal project with only biome and without eslint. The eslint would just fail to run and the biome would not get run at all. There is another option where I can call both formatters. But then the unconfigured biome would override configs written by eslint_d, So I'd like to know is there any way to call the second formatter when the first one failed?. Thank you for the response.
Provide background
No response
What is the significance of this feature?
nice to have
Additional details
Current workaround for me now is to swap the order of the formatter and bring biome in the front.
You can define a function with custom logic to differentiate between the two. For example a config is present use eslint if not use biome. An example of this can be found in the docs like so:
python = function(bufnr)
if require("conform").get_formatter_info("ruff_format", bufnr).available then
return { "ruff_format" }
else
return { "isort", "black" }
end
end