Skip to content

Commit a15b229

Browse files
committed
Recognise "FOURMOLU_ENABLE" etc.
1 parent 6fde818 commit a15b229

2 files changed

Lines changed: 7 additions & 5 deletions

File tree

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,22 +76,24 @@ Fourmolu can be integrated with your editor via the [Haskell Language Server](ht
7676
Fourmolu understands two magic comments:
7777

7878
```haskell
79-
{- ORMOLU_DISABLE -}
79+
{- FOURMOLU_DISABLE -}
8080
```
8181

8282
and
8383

8484
```haskell
85-
{- ORMOLU_ENABLE -}
85+
{- FOURMOLU_ENABLE -}
8686
```
8787

8888
This allows us to disable formatting selectively for code between these
8989
markers or disable it for the entire file. To achieve the latter, just put
90-
`{- ORMOLU_DISABLE -}` at the very top. Note that the source code should
90+
`{- FOURMOLU_DISABLE -}` at the very top. Note that the source code should
9191
still be parseable even without the “excluded” part. Because of that the
9292
magic comments cannot be placed arbitrary, but should rather enclose
9393
independent top-level definitions.
9494

95+
`{- ORMOLU_DISABLE -}` and `{- ORMOLU_ENABLE -}`, respectively, can be used to the same effect.
96+
9597
## Current limitations
9698

9799
* CPP support is experimental. CPP is virtually impossible to handle

src/Ormolu/Processing/Preprocess.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,11 +127,11 @@ disableMarker = "{- ORMOLU_DISABLE -}"
127127

128128
-- | Return 'True' if the given string is an enabling marker.
129129
isOrmoluEnable :: String -> Bool
130-
isOrmoluEnable = magicComment "ORMOLU_ENABLE"
130+
isOrmoluEnable s = magicComment "ORMOLU_ENABLE" s || magicComment "FOURMOLU_ENABLE" s
131131

132132
-- | Return 'True' if the given string is a disabling marker.
133133
isOrmoluDisable :: String -> Bool
134-
isOrmoluDisable = magicComment "ORMOLU_DISABLE"
134+
isOrmoluDisable s = magicComment "ORMOLU_DISABLE" s || magicComment "FOURMOLU_DISABLE" s
135135

136136
-- | Construct a function for whitespace-insensitive matching of string.
137137
magicComment ::

0 commit comments

Comments
 (0)