diff --git a/lua/plugins/conform.lua b/lua/plugins/conform.lua index cdb8ae4..4ee38f4 100644 --- a/lua/plugins/conform.lua +++ b/lua/plugins/conform.lua @@ -16,22 +16,18 @@ return { opts = { notify_on_error = false, format_on_save = function(bufnr) - -- Filetypes to apply formatting to on save. Remove from this list - -- to disable formatting on save for that filetype. - local filetypes = { - 'lua', - 'rust', + local autoformat_filetypes = { + lua = true, + rust = true, } - local lsp_format_opt - if filetypes[vim.bo[bufnr].filetype] then - lsp_format_opt = 'fallback' + if autoformat_filetypes[vim.bo[bufnr].filetype] then + return { + timeout_ms = 500, + lsp_format = 'fallback', + } else - lsp_format_opt = 'never' + return end - return { - timeout_ms = 500, - lsp_format = lsp_format_opt, - } end, formatters_by_ft = { lua = { 'stylua' },