diff options
author | Steven Arcangeli <stevearc@stevearc.com> | 2023-09-08 08:48:33 -0700 |
---|---|---|
committer | Steven Arcangeli <stevearc@stevearc.com> | 2023-09-08 09:09:17 -0700 |
commit | 2568d746abbadf66a03c62b568ee73d874cd8617 (patch) | |
tree | f111dfde4eed5b9d0d7b55c9a242e1b0345fa44e /scripts/options_doc.lua | |
parent | bd1aa02ef191410b2ea0b3ef5caabe06592d9c51 (diff) |
feat: syntax for using first available formatter
Alternations are now supported. You can specify a sub-list in place of a
formatter name and conform will use the first formatter in that list
that is available. For example, this will use either prettierd or
prettier (whichever is available), and then always trim whitespace
afterwards:
conform.format(formatters = { { "prettierd", "prettier" }, "trim_whitespace" })
This syntax is available both in the formatters_by_ft config option and
in the `formatters` argument of the `format` method.
Diffstat (limited to 'scripts/options_doc.lua')
-rw-r--r-- | scripts/options_doc.lua | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/scripts/options_doc.lua b/scripts/options_doc.lua index a796501..47eccd9 100644 --- a/scripts/options_doc.lua +++ b/scripts/options_doc.lua @@ -4,6 +4,8 @@ require("conform").setup({ lua = { "stylua" }, -- Conform will run multiple formatters sequentially python = { "isort", "black" }, + -- Use a sub-list to run only the first available formatter + javascript = { { "prettierd", "prettier" } }, }, -- If this is set, Conform will run the formatter on save. -- It will pass the table to conform.format(). |