Skip to content
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

Support fourmolu 0.13 #3662

Merged
merged 4 commits into from
Jun 15, 2023
Merged
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
21 changes: 14 additions & 7 deletions plugins/hls-fourmolu-plugin/src/Ide/Plugin/Fourmolu/Shim.hs
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,15 @@ import Ormolu.Fixity

{-- Backport FourmoluConfig --}

#if !MIN_VERSION_fourmolu(0,7,0)
#if MIN_VERSION_fourmolu(0,7,0)
-- these functions are now defined
#else
type FourmoluConfig = PrinterOptsPartial

cfgFilePrinterOpts :: FourmoluConfig -> PrinterOptsPartial
cfgFilePrinterOpts = id

cfgFileFixities :: FourmoluConfig -> FixityMap
cfgFileFixities :: FourmoluConfig -> FixityOverrides
cfgFileFixities _ = mempty
#endif

Expand All @@ -45,15 +47,20 @@ emptyConfig :: FourmoluConfig
emptyConfig = mempty
#endif

{-- Backport FixityMap --}
{-- Backport FixityOverrides --}

#if MIN_VERSION_fourmolu(0,7,0)
addFixityOverrides :: FixityMap -> Config region -> Config region
#if MIN_VERSION_fourmolu(0,13,0)
addFixityOverrides :: FixityOverrides -> Config region -> Config region
addFixityOverrides fixities cfg = cfg{cfgFixityOverrides = fixities}
#elif MIN_VERSION_fourmolu(0,7,0)
type FixityOverrides = FixityMap

addFixityOverrides :: FixityOverrides -> Config region -> Config region
addFixityOverrides fixities cfg = cfg{cfgFixityOverrides = fixities}
#else
type FixityMap = ()
type FixityOverrides = ()

addFixityOverrides :: FixityMap -> Config region -> Config region
addFixityOverrides :: FixityOverrides -> Config region -> Config region
addFixityOverrides _ = id
#endif

Expand Down
2 changes: 1 addition & 1 deletion plugins/hls-fourmolu-plugin/test/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ tests =
(if cli then "cli" else "lib")
[ goldenWithFourmolu cli "formats correctly" "Fourmolu" "formatted" $ \doc -> do
formatDoc doc (FormattingOptions 4 True Nothing Nothing Nothing)
, goldenWithFourmolu cli "formats imports correctly" "Fourmolu" "formatted" $ \doc -> do
, goldenWithFourmolu cli "formats imports correctly" "Fourmolu2" "formatted" $ \doc -> do
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to have been testing the wrong file for quite a while:
f653555#diff-5e783ba6072f1ca27c7171a3ece5043ea46f212e57f68272b52ecc36a8152d59L26-L36

formatDoc doc (FormattingOptions 4 True Nothing Nothing Nothing)
]

Expand Down