treefmt icon indicating copy to clipboard operation
treefmt copied to clipboard

Multiple formatters when using --stdin

Open terlar opened this issue 2 years ago • 0 comments

Is your feature request related to a problem? Please describe.

I configured the formatter dos2unix which I essentially applied to all files in the project, then everything seemed to work fine, however in my editor I utilize treefmt --stdin FILENAME < BUFFER in order to have consistent formatting across the project without duplicate configuration. Recently I noticed the formatting stopped working and when I debugged this I got this:

$ treefmt --stdin test.nix < test.nix
[WARN ] multiple formatters matched the path. picking the first one
{a = 1; b = 2; c = 3;}

So it didn't format the file because dos2unix was the first one.

Describe the solution you'd like

Either a way to select which formatter has priority in this case, or I guess the best case would be to run all the formatters, just like it does when you apply via treefmt test.nix.

Describe alternatives you've considered

  • Not have multiple formatters touching the same files.
  • Format file directly via argument, however my editor formatter relies on stdin/stdout formatting.

terlar avatar Mar 14 '24 16:03 terlar