Skip to content
This repository was archived by the owner on Oct 7, 2020. It is now read-only.

Commit 711776c

Browse files
committed
Refactor CPP guards, complete noop for GHC < 8.6
1 parent bb086ed commit 711776c

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

src/Haskell/Ide/Engine/Plugin/Ormolu.hs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,22 +32,18 @@ ormoluDescriptor plId = PluginDescriptor
3232
, pluginFormattingProvider = Just provider
3333
}
3434

35-
#if __GLASGOW_HASKELL__ >= 806
35+
3636
provider :: FormattingProvider
3737
provider contents uri typ _opts =
3838
case typ of
39+
#if __GLASGOW_HASKELL__ >= 806
3940
FormatRange _ -> return $ IdeResultFail (IdeError PluginError (pack "Selection formatting for Ormolu is not currently supported.") Null)
4041
FormatText -> pluginGetFile contents uri $ \file -> do
4142
result <- liftIO $ try @OrmoluException (ormolu defaultConfig file (unpack contents))
4243
case result of
4344
Left err -> return $ IdeResultFail (IdeError PluginError (pack $ "ormoluCmd: " ++ show err) Null)
4445
Right new -> return $ IdeResultOk [TextEdit (fullRange contents) new]
4546
#else
46-
-- Work in progress
47-
provider :: FormattingProvider
48-
provider _contents _uri typ _opts = do
49-
errorm "This version of HIE does not support Ormolu as a formatter"
50-
case typ of
51-
FormatRange _ -> return $ IdeResultFail (IdeError PluginError (pack "Selection formatting for Ormolu is not currently supported.") Null)
47+
FormatRange _ -> return $ IdeResultOk []
5248
FormatText -> return $ IdeResultOk []
5349
#endif

0 commit comments

Comments
 (0)