Skip to content

Commit ccd11ca

Browse files
committed
fix(formatexpr)!: do not fallback to the built-in formatter
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.
1 parent 7711eae commit ccd11ca

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lua/conform/init.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -719,7 +719,8 @@ M.formatexpr = function(opts)
719719
-- No formatters were available; fall back to lsp formatter
720720
return vim.lsp.formatexpr({ timeout_ms = opts.timeout_ms })
721721
else
722-
return 1
722+
-- Do not fallback to built-in formatter.
723+
return 0
723724
end
724725
end
725726

0 commit comments

Comments
 (0)