Skip to content

Commit

Permalink
Bump Fourmolu to 0.4 (#2254)
Browse files Browse the repository at this point in the history
* Allow Fourmolu 0.4

* Reformat record construction to Fourmolu style

* Run stylish-haskell on imports

* Enable fourmolu for ghc-9

* Enable fourmolu tests for ghc-9

* Enable fourmolu for ghc-9 and stack

* Correct stack-9.0.1.yaml changes

* Use explicit import to avoid shadowing

* Remove unused import

* Bump plugin version

* Enable -Wall

Co-authored-by: Javier Neira <atreyu.bbb@gmail.com>
  • Loading branch information
georgefst and jneira authored Oct 5, 2021
1 parent f80f07a commit ee4b496
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 25 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ jobs:
name: Test hls-ormolu-plugin
run: cabal test hls-ormolu-plugin --test-options="-j1 --rerun-update" || cabal test hls-ormolu-plugin --test-options="-j1 --rerun" || LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true cabal test hls-ormolu-plugin --test-options="-j1 --rerun"

- if: ${{ needs.pre_job.outputs.should_skip != 'true' && matrix.test && matrix.ghc != '9.0.1' }}
- if: ${{ needs.pre_job.outputs.should_skip != 'true' && matrix.test }}
name: Test hls-fourmolu-plugin
run: cabal test hls-fourmolu-plugin --test-options="-j1 --rerun-update" || cabal test hls-fourmolu-plugin --test-options="-j1 --rerun" || LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true cabal test hls-fourmolu-plugin --test-options="-j1 --rerun"

Expand Down
6 changes: 3 additions & 3 deletions cabal-ghc901.project
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ packages:
-- ./plugins/hls-tactics-plugin
-- ./plugins/hls-brittany-plugin
-- ./plugins/hls-stylish-haskell-plugin
-- ./plugins/hls-fourmolu-plugin
./plugins/hls-fourmolu-plugin
-- ./plugins/hls-class-plugin
./plugins/hls-eval-plugin
./plugins/hls-explicit-imports-plugin
Expand Down Expand Up @@ -55,11 +55,11 @@ source-repository-package

write-ghc-environment-files: never

index-state: 2021-09-29T21:38:47Z
index-state: 2021-10-04T02:41:06Z

constraints:
-- These plugins don't work on GHC9 yet
haskell-language-server -brittany -class -fourmolu -stylishhaskell -tactic
haskell-language-server -brittany -class -stylishhaskell -tactic

allow-newer:
floskell:base,
Expand Down
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
7 changes: 4 additions & 3 deletions plugins/hls-fourmolu-plugin/hls-fourmolu-plugin.cabal
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cabal-version: 2.4
name: hls-fourmolu-plugin
version: 1.0.0.2
version: 1.0.1.0
synopsis: Integration with the Fourmolu code formatter
description:
Please see the README on GitHub at <https://github.com/haskell/haskell-language-server#readme>
Expand All @@ -19,10 +19,11 @@ extra-source-files:
library
exposed-modules: Ide.Plugin.Fourmolu
hs-source-dirs: src
ghc-options: -Wall
build-depends:
, base >=4.12 && <5
, filepath
, fourmolu ^>=0.3
, fourmolu ^>=0.3 || ^>=0.4
, ghc
, ghc-boot-th
, ghcide >=1.2 && <1.5
Expand All @@ -38,7 +39,7 @@ test-suite tests
default-language: Haskell2010
hs-source-dirs: test
main-is: Main.hs
ghc-options: -threaded -rtsopts -with-rtsopts=-N
ghc-options: -Wall -threaded -rtsopts -with-rtsopts=-N
build-depends:
, base
, filepath
Expand Down
29 changes: 14 additions & 15 deletions plugins/hls-fourmolu-plugin/src/Ide/Plugin/Fourmolu.hs
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,20 @@ 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
import GHC.LanguageExtensions.Type (Extension (Cpp))
import GhcPlugins (HscEnv (hsc_dflags))
import Ide.PluginUtils (makeDiffTextEdit)
import GHC.LanguageExtensions.Type (Extension (Cpp))
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 Language.LSP.Types.Lens (HasTabSize (tabSize))
import Ormolu
import System.FilePath

Expand Down Expand Up @@ -70,10 +69,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
4 changes: 2 additions & 2 deletions stack-9.0.1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ packages:
# - ./plugins/hls-brittany-plugin
# - ./plugins/hls-stylish-haskell-plugin
- ./plugins/hls-floskell-plugin
# - ./plugins/hls-fourmolu-plugin
- ./plugins/hls-fourmolu-plugin
- ./plugins/hls-pragmas-plugin
- ./plugins/hls-module-name-plugin
- ./plugins/hls-ormolu-plugin
Expand All @@ -38,6 +38,7 @@ extra-deps:
- dependent-sum-0.7.1.0@sha256:0e419237f5b86da3659772afff9cab355c0f8d5b3fdb15a5b30e673d8dc83941,2147
- extra-1.7.9
- floskell-0.10.5
- fourmolu-0.4.0.0
- ghc-source-gen-0.4.1.0
- heapsize-0.3.0.1@sha256:0b69aa97a46d819b700ac7b145f3b5493c3565cf2c5b8298682238d405d0326e,1417
- hie-bios-0.7.6
Expand Down Expand Up @@ -104,7 +105,6 @@ flags:
class: false
tactic: false # Dependencies fail

fourmolu: false
stylishHaskell: false
brittany: false
retrie:
Expand Down

0 comments on commit ee4b496

Please sign in to comment.