From 48bc9996ebfe90e7766f46338360f75fd6ecb174 Mon Sep 17 00:00:00 2001 From: Jongwook Choi Date: Fri, 8 Dec 2023 01:36:38 -0500 Subject: fix(formatexpr): does not fallback to the built-in formatexpr (#238) This makes the behavior of formatexpr more consistent with `vim.lsp.formatexpr`; do not run vim's builtin formatter. Problem: When conform's formatexpr is used and (range or buffer) but conform can't do formatting and there is no LSP formatter with the formatting capabilities, it will fall back to the (wrong) built-in formatting, which might result in simply concatenating all the words. This is a breaking change, reverting the behavior introduced in #55. --- lua/conform/init.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lua') diff --git a/lua/conform/init.lua b/lua/conform/init.lua index d980b8f..3824b4b 100644 --- a/lua/conform/init.lua +++ b/lua/conform/init.lua @@ -719,7 +719,8 @@ M.formatexpr = function(opts) -- No formatters were available; fall back to lsp formatter return vim.lsp.formatexpr({ timeout_ms = opts.timeout_ms }) else - return 1 + -- Do not fallback to built-in formatter. + return 0 end end -- cgit v1.2.3-70-g09d2