tweag / ormolu

A formatter for Haskell source code
https://ormolu-live.tweag.io
Other
958 stars 83 forks source link

What's current solution to enable BangPatterns (etc.) without putting it in every file? #650

Closed complyue closed 3 years ago

complyue commented 4 years ago

Describe the bug This is a technical question, maybe a bug in documentation.

I can't figure out on my own how to:

enable BangPatterns (etc.) without putting it in every file

PR #157 marked many related issues solved, but BangPatterns seems not working still, and I don't know how to tell ormolu about it, as the configuration seems removed. (my .cabal file already has it for the record)

Or it can only be enabled by putting pragma per source file, I think it's better stated in some obvious where.

To Reproduce Let ormolu format a file with BangPatterns syntax, but no language pragma in that file. Such a file normally exists in a project with .cabal file stating what language extensions are enabled.

Expected behavior Format without err out.

Environment Any

Additional context No

mrkkrp commented 4 years ago

Use --ghc-opt -XBangPatterns.

complyue commented 4 years ago

Wah! That's so quick! @mrkkrp

And I'm working from VSCode with HLS, it has "ormolu" as an option under "Formatting Provider", but seems no cmdl conf options there, maybe I should file an issue there.