stevearc / conform.nvim

Lightweight yet powerful formatter plugin for Neovim
MIT License
3.01k stars 156 forks source link

fix: ignore empty opts.formatters like nil #464

Closed Frederick888 closed 3 months ago

Frederick888 commented 3 months ago

Same rationale as [1]. When there are no LSP formatters and opts.formatters = {}, we should normally call list_formatters_for_buffer.

[1] https://github.com/stevearc/conform.nvim/commit/bde3bee1773c96212b6c49f009e05174f932c23a

Frederick888 commented 3 months ago

I guess I somehow managed to confuse myself in #463 lol...

stevearc commented 3 months ago

Hmmm...I'm not sure about this one. The normal behavior is that if you explicitly pass in formatters, we ignore the formatters_by_ft and only use the formatters you passed in. This would change that behavior so that we do use the formatters_by_ft if formatters is passed in but is an empty table. What is the reasoning behind this change?

Frederick888 commented 3 months ago

Hmm, I was just playing around with different combinations of arguments. But yeah, now it makes sense to me that this is actually intentional. Thanks!