diff options
author | Steven Arcangeli <stevearc@stevearc.com> | 2023-11-04 13:24:48 -0700 |
---|---|---|
committer | Steven Arcangeli <stevearc@stevearc.com> | 2023-11-04 13:31:35 -0700 |
commit | 0bbe83830be5a07a1161bb1a23d7280310656177 (patch) | |
tree | c08a901c6ace758e9cfcaff49f5ba78837f79e40 /lua/conform/health.lua | |
parent | 893b139e6dcdb55dee4c98215d9217d3a1ec69eb (diff) |
feat: allow formatters_by_ft to be a function (#174)
Diffstat (limited to 'lua/conform/health.lua')
-rw-r--r-- | lua/conform/health.lua | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lua/conform/health.lua b/lua/conform/health.lua index 7132007..3a1c9f6 100644 --- a/lua/conform/health.lua +++ b/lua/conform/health.lua @@ -12,8 +12,14 @@ local function get_formatter_filetypes(name) local conform = require("conform") local filetypes = {} for filetype, formatters in pairs(conform.formatters_by_ft) do + if type(formatters) == "function" then + formatters = formatters(0) -- support the old structure where formatters could be a subkey - if not vim.tbl_islist(formatters) then + elseif not vim.tbl_islist(formatters) then + vim.notify_once( + "Using deprecated structure for formatters_by_ft. See :help conform-options for details.", + vim.log.levels.ERROR + ) ---@diagnostic disable-next-line: undefined-field formatters = formatters.formatters end |