Skip to content

Commit 63c09e3

Browse files
committed
Allow ormolu-0.5.3
1 parent 292f459 commit 63c09e3

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

plugins/hls-ormolu-plugin/hls-ormolu-plugin.cabal

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,7 @@ library
3232
, hls-plugin-api ^>=1.3 || ^>=1.4 || ^>= 1.5 || ^>= 1.6
3333
, lens
3434
, lsp
35-
-- we are incompatible with 0.5.3.
36-
-- See upstream ticket: https://github.com/tweag/ormolu/issues/981
37-
, ormolu ^>=0.1.2 || ^>= 0.2 || ^>= 0.3 || (>= 0.5 && < 0.5.3)
35+
, ormolu ^>=0.1.2 || ^>= 0.2 || ^>= 0.3 || ^>= 0.5
3836
, text
3937

4038
default-language: Haskell2010

plugins/hls-ormolu-plugin/src/Ide/Plugin/Ormolu.hs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
{-# LANGUAGE CPP #-}
12
{-# LANGUAGE OverloadedStrings #-}
23
{-# LANGUAGE TypeApplications #-}
34

@@ -45,7 +46,11 @@ provider ideState typ contents fp _ = withIndefiniteProgress title Cancellable $
4546
mkConf o region = defaultConfig { cfgDynOptions = o, cfgRegion = region }
4647
fmt :: T.Text -> Config RegionIndices -> IO (Either OrmoluException T.Text)
4748
fmt cont conf =
49+
#if MIN_VERSION_ormolu(0,5,3)
50+
try @OrmoluException $ ormolu conf (fromNormalizedFilePath fp) cont
51+
#else
4852
try @OrmoluException $ ormolu conf (fromNormalizedFilePath fp) $ T.unpack cont
53+
#endif
4954

5055
case typ of
5156
FormatText -> ret <$> fmt contents (mkConf fileOpts fullRegion)

0 commit comments

Comments
 (0)