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

Add support for Fourmolu 0.8 #3078

Merged
merged 4 commits into from
Aug 7, 2022
Merged

Add support for Fourmolu 0.8 #3078

merged 4 commits into from
Aug 7, 2022

Conversation

brandonchinn178
Copy link
Contributor

@brandonchinn178 brandonchinn178 commented Aug 6, 2022

Also includes some clean up. Will we always be supporting every version of Fourmolu, or will HLS ever remove support for old versions of Fourmolu?

cc @parsonsmatt @georgefst

Comment on lines +41 to +40
emptyConfig :: FourmoluConfig
emptyConfig =
FourmoluConfig
{ cfgFilePrinterOpts = mempty
, cfgFileFixities = mempty
}
Copy link
Contributor Author

@brandonchinn178 brandonchinn178 Aug 6, 2022

Choose a reason for hiding this comment

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

condition will eventually be #if !MIN_VERSION_fourmolu(0,8,1): fourmolu/fourmolu#221

Copy link
Collaborator

@georgefst georgefst left a comment

Choose a reason for hiding this comment

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

Thanks!

first (mkError . show)
<$> try @OrmoluException (makeDiffTextEdit contents <$> ormolu config fp' (T.unpack contents))
bimap (mkError . show) (makeDiffTextEdit contents)
<$> try @OrmoluException (ormolu config fp' (T.unpack contents))
Copy link
Collaborator

@georgefst georgefst Aug 7, 2022

Choose a reason for hiding this comment

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

Nice. Surprised I didn't notice that opportunity.

@@ -0,0 +1,68 @@
{-# LANGUAGE CPP #-}

module Ide.Plugin.Fourmolu.Shim (
Copy link
Collaborator

Choose a reason for hiding this comment

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

Excellent. This is much cleaner.

@georgefst
Copy link
Collaborator

Will we always be supporting every version of Fourmolu, or will HLS ever remove support for old versions of Fourmolu?

I don't see a reason to keep really old versions around, especially if it means huge amounts of CPP. But it's likely that some people won't want to be forced in to updating Fourmolu (and thus probably reformatting their codebase) by an HLS update*. Then again, part of the reason for adding the CLI mode was to give users that flexibility.

I've wanted to remove some backwards compatibility before, but it wasn't possible then because of constraints from HLS' other dependencies: #2951.

* Although in practice, most people are getting HLS from bindists, so they don't have much choice without building from source instead.

@georgefst georgefst merged commit 9c76ac9 into haskell:master Aug 7, 2022
@brandonchinn178 brandonchinn178 deleted the fourmolu-0.8 branch August 7, 2022 19:34
@brandonchinn178
Copy link
Contributor Author

@georgefst By "building from source", do you mean fourmolu? Now that we release binaries on the releases page, is there some hls logic that can download fourmolu binaries where possible instead of building fourmolu? (Even better, make that the canonical way; dont bundle fourmolu in hls, just have hls provide a dropdown to install version of fourmolu)

Keeping old versions isnt terrible right now, because all the cpp is for the 0.7 upgrade. But I think maybe once 0.7 becomes two years old (or something) itd be nice to drop support

@georgefst
Copy link
Collaborator

@georgefst By "building from source", do you mean fourmolu?

I meant HLS, but I suppose that statement works for either, once you take the CLI option in to account.

We could make downloading the binary the default, but I'm more confident of correctness when using the library. And it would go against the way every other HLS plugin is doing things (although that is not, in itself, a great argument against).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants