Skip to content

Bump Fourmolu to 0.4 #2254

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

Merged
merged 13 commits into from
Oct 5, 2021
2 changes: 1 addition & 1 deletion cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ package *

write-ghc-environment-files: never

index-state: 2021-09-16T07:00:23Z
index-state: 2021-10-04T02:41:06Z

constraints:
hyphenation +embed
Expand Down
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 @@ -22,7 +22,7 @@ library
build-depends:
, base >=4.12 && <5
, filepath
, fourmolu ^>=0.3
, fourmolu ^>=0.3 || ^>=0.4
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ideally, I'd remove 0.3 entirely, as 0.4 includes some important bug fixes. But this isn't possible while stylish-haskell is tied to older versions of GHC and Cabal.

(Same applies to Ormolu here - right now, the latest version will never be chosen by the dependency solver)

Copy link
Collaborator Author

@georgefst georgefst Oct 4, 2021

Choose a reason for hiding this comment

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

the latest version will never be chosen by the dependency solver

Actually, looks like this only applies to GHC < 9. The stylish-haskell plugin is disabled for 9.0.1.

And if CI passes here for GHC 9.0.1, we know that Fourmolu 0.4 is being used, since it's the first version to support it.

Copy link
Member

Choose a reason for hiding this comment

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

Maybe adding a comment about, to remove 0.3 some day?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Maybe adding a comment about, to remove 0.3 some day?

Actually, I think there's no need. I'll probably end up at least trying to remove it every time I bump the upper bound, and eventually it'll be possible.

, ghc
, ghc-boot-th
, ghcide >=1.2 && <1.5
Expand Down
28 changes: 14 additions & 14 deletions plugins/hls-fourmolu-plugin/src/Ide/Plugin/Fourmolu.hs
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@ module Ide.Plugin.Fourmolu (
provider,
) where

import Control.Exception (try)
import Control.Lens ((^.))
import Control.Exception (try)
import Control.Lens ((^.))
import Control.Monad.IO.Class
import Data.Bifunctor (first)
import qualified Data.Text as T
import Development.IDE hiding (pluginHandlers)
import Development.IDE.GHC.Compat as Compat hiding (Cpp)
import Data.Bifunctor (first)
import qualified Data.Text as T
import Development.IDE hiding (pluginHandlers)
import Development.IDE.GHC.Compat as Compat hiding (Cpp)
import qualified Development.IDE.GHC.Compat.Util as S
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I don't know how this file was passing CI before? Seeing as this line causes stylish-haskell to reformat all the other imports (I personally detest this behaviour, but that's an argument for another day).

import GHC.LanguageExtensions.Type (Extension (Cpp))
import GhcPlugins (HscEnv (hsc_dflags))
import Ide.PluginUtils (makeDiffTextEdit)
import GHC.LanguageExtensions.Type (Extension (Cpp))
import GhcPlugins (HscEnv (hsc_dflags))
import Ide.PluginUtils (makeDiffTextEdit)
import Ide.Types
import Language.LSP.Server hiding (defaultConfig)
import Language.LSP.Server hiding (defaultConfig)
import Language.LSP.Types
import Language.LSP.Types.Lens
import Ormolu
Expand Down Expand Up @@ -70,10 +70,10 @@ provider ideState typ contents fp fo = withIndefiniteProgress title Cancellable
format mempty
ConfigParseError f (_, err) -> do
sendNotification SWindowShowMessage $
ShowMessageParams
{ _xtype = MtError
, _message = errorMessage
}
ShowMessageParams
{ _xtype = MtError
, _message = errorMessage
}
return . Left $ responseError errorMessage
where
errorMessage = "Failed to load " <> T.pack f <> ": " <> T.pack err
Expand Down