Skip to content

Drop support for pre-0.7 versions of the Fourmolu library #2951

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion plugins/hls-fourmolu-plugin/hls-fourmolu-plugin.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ library
build-depends:
, base >=4.12 && <5
, filepath
, fourmolu ^>=0.3 || ^>=0.4 || ^>= 0.6 || ^>= 0.7
, fourmolu ^>= 0.7
, ghc
, ghc-boot-th
, ghcide ^>=1.7
Expand Down
24 changes: 2 additions & 22 deletions plugins/hls-fourmolu-plugin/src/Ide/Plugin/Fourmolu.hs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DisambiguateRecordFields #-}
{-# LANGUAGE LambdaCase #-}
Expand Down Expand Up @@ -85,13 +84,7 @@ provider plId ideState typ contents fp fo = withIndefiniteProgress title Cancell
first (mkError . show)
<$> try @OrmoluException (makeDiffTextEdit contents <$> ormolu config fp' (T.unpack contents))
where
printerOpts =
#if MIN_VERSION_fourmolu(0,7,0)
cfgFilePrinterOpts fourmoluConfig
#else
fourmoluConfig

#endif
printerOpts = cfgFilePrinterOpts fourmoluConfig
config =
defaultConfig
{ cfgDynOptions = map DynOption fileOpts
Expand All @@ -101,10 +94,8 @@ provider plId ideState typ contents fp fo = withIndefiniteProgress title Cancell
fillMissingPrinterOpts
(printerOpts <> lspPrinterOpts)
defaultPrinterOpts
#if MIN_VERSION_fourmolu(0,7,0)
, cfgFixityOverrides =
cfgFileFixities fourmoluConfig
#endif
}
in liftIO (loadConfigFile fp') >>= \case
ConfigLoaded file opts -> liftIO $ do
Expand All @@ -118,15 +109,10 @@ provider plId ideState typ contents fp fo = withIndefiniteProgress title Cancell
format emptyOptions
where
emptyOptions =
#if MIN_VERSION_fourmolu(0,7,0)
FourmoluConfig
{ cfgFilePrinterOpts = mempty
, cfgFileFixities = mempty
}
#else
mempty
#endif

ConfigParseError f err -> do
sendNotification SWindowShowMessage $
ShowMessageParams
Expand All @@ -135,13 +121,7 @@ provider plId ideState typ contents fp fo = withIndefiniteProgress title Cancell
}
return . Left $ responseError errorMessage
where
errorMessage = "Failed to load " <> T.pack f <> ": " <> T.pack (convertErr err)
convertErr =
#if MIN_VERSION_fourmolu(0,7,0)
show
#else
snd
#endif
errorMessage = "Failed to load " <> T.pack f <> ": " <> T.pack (show err)
where
fp' = fromNormalizedFilePath fp
title = "Formatting " <> T.pack (takeFileName fp')
Expand Down