Closed scott-fleischman closed 4 years ago
The cases in particular that I would like to preserve formatting are ones with grid-like vertical alignment that end up looking like a table. I don't foresee ormolu supporting this kind of style in the future.
This sounds like a good usecase. Another usecase is "we have code that Ormolu breaks on, but we want to start using Ormolu in production anyway".
It could be nicely supported via the {-# ANN #-}
mechanism.
Escape hatches are good. {-# ANN #-}
could well work, as @neongreen suggests.
I'd recommend against ANN comments for this sort of annotation. They can increase compilation times or cause more recompilation, since they're evaluated at compile time and require loading dependencies (similar to TemplateHaskell). http://neilmitchell.blogspot.com/2019/01/ignoring-hlint.html
Regular comments {- ORMOLU ... -}
could work. Hlint now allows something similar, as described in the above link.
I am experimenting with using ormolu with "format on save" in my editor, and sometimes I wish to edit code without updating all of the styling.
One idea that came to mind is having some comment that I could put near the top of a file that ormolu can see and would choose not to style the file. I searched a bit and didn't see an existing feature like that.
It could be useful for two cases: 1) the case I am in, so I can add the line to a file and not have it updated 2) to allow some files to not fail the build if using ormolu in check mode
The cases in particular that I would like to preserve formatting are ones with grid-like vertical alignment that end up looking like a table. I don't foresee ormolu supporting this kind of style in the future.
It's possible one might want to disable a smaller portion of code, such as a top-level definition that is aligned in this way.