Skip to content

Commit ee4b496

Browse files
georgefstjneira
andauthored
Bump Fourmolu to 0.4 (#2254)
* 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 <[email protected]>
1 parent f80f07a commit ee4b496

File tree

6 files changed

+25
-25
lines changed

6 files changed

+25
-25
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ jobs:
196196
name: Test hls-ormolu-plugin
197197
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"
198198

199-
- if: ${{ needs.pre_job.outputs.should_skip != 'true' && matrix.test && matrix.ghc != '9.0.1' }}
199+
- if: ${{ needs.pre_job.outputs.should_skip != 'true' && matrix.test }}
200200
name: Test hls-fourmolu-plugin
201201
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"
202202

cabal-ghc901.project

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ packages:
99
-- ./plugins/hls-tactics-plugin
1010
-- ./plugins/hls-brittany-plugin
1111
-- ./plugins/hls-stylish-haskell-plugin
12-
-- ./plugins/hls-fourmolu-plugin
12+
./plugins/hls-fourmolu-plugin
1313
-- ./plugins/hls-class-plugin
1414
./plugins/hls-eval-plugin
1515
./plugins/hls-explicit-imports-plugin
@@ -55,11 +55,11 @@ source-repository-package
5555

5656
write-ghc-environment-files: never
5757

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

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

6464
allow-newer:
6565
floskell:base,

cabal.project

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ package *
3838

3939
write-ghc-environment-files: never
4040

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

4343
constraints:
4444
hyphenation +embed

plugins/hls-fourmolu-plugin/hls-fourmolu-plugin.cabal

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
cabal-version: 2.4
22
name: hls-fourmolu-plugin
3-
version: 1.0.0.2
3+
version: 1.0.1.0
44
synopsis: Integration with the Fourmolu code formatter
55
description:
66
Please see the README on GitHub at <https://github.com/haskell/haskell-language-server#readme>
@@ -19,10 +19,11 @@ extra-source-files:
1919
library
2020
exposed-modules: Ide.Plugin.Fourmolu
2121
hs-source-dirs: src
22+
ghc-options: -Wall
2223
build-depends:
2324
, base >=4.12 && <5
2425
, filepath
25-
, fourmolu ^>=0.3
26+
, fourmolu ^>=0.3 || ^>=0.4
2627
, ghc
2728
, ghc-boot-th
2829
, ghcide >=1.2 && <1.5
@@ -38,7 +39,7 @@ test-suite tests
3839
default-language: Haskell2010
3940
hs-source-dirs: test
4041
main-is: Main.hs
41-
ghc-options: -threaded -rtsopts -with-rtsopts=-N
42+
ghc-options: -Wall -threaded -rtsopts -with-rtsopts=-N
4243
build-depends:
4344
, base
4445
, filepath

plugins/hls-fourmolu-plugin/src/Ide/Plugin/Fourmolu.hs

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,20 @@ module Ide.Plugin.Fourmolu (
88
provider,
99
) where
1010

11-
import Control.Exception (try)
12-
import Control.Lens ((^.))
11+
import Control.Exception (try)
12+
import Control.Lens ((^.))
1313
import Control.Monad.IO.Class
14-
import Data.Bifunctor (first)
15-
import qualified Data.Text as T
16-
import Development.IDE hiding (pluginHandlers)
17-
import Development.IDE.GHC.Compat as Compat hiding (Cpp)
14+
import Data.Bifunctor (first)
15+
import qualified Data.Text as T
16+
import Development.IDE hiding (pluginHandlers)
17+
import Development.IDE.GHC.Compat as Compat hiding (Cpp)
1818
import qualified Development.IDE.GHC.Compat.Util as S
19-
import GHC.LanguageExtensions.Type (Extension (Cpp))
20-
import GhcPlugins (HscEnv (hsc_dflags))
21-
import Ide.PluginUtils (makeDiffTextEdit)
19+
import GHC.LanguageExtensions.Type (Extension (Cpp))
20+
import Ide.PluginUtils (makeDiffTextEdit)
2221
import Ide.Types
23-
import Language.LSP.Server hiding (defaultConfig)
22+
import Language.LSP.Server hiding (defaultConfig)
2423
import Language.LSP.Types
25-
import Language.LSP.Types.Lens
24+
import Language.LSP.Types.Lens (HasTabSize (tabSize))
2625
import Ormolu
2726
import System.FilePath
2827

@@ -70,10 +69,10 @@ provider ideState typ contents fp fo = withIndefiniteProgress title Cancellable
7069
format mempty
7170
ConfigParseError f (_, err) -> do
7271
sendNotification SWindowShowMessage $
73-
ShowMessageParams
74-
{ _xtype = MtError
75-
, _message = errorMessage
76-
}
72+
ShowMessageParams
73+
{ _xtype = MtError
74+
, _message = errorMessage
75+
}
7776
return . Left $ responseError errorMessage
7877
where
7978
errorMessage = "Failed to load " <> T.pack f <> ": " <> T.pack err

stack-9.0.1.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ packages:
2222
# - ./plugins/hls-brittany-plugin
2323
# - ./plugins/hls-stylish-haskell-plugin
2424
- ./plugins/hls-floskell-plugin
25-
# - ./plugins/hls-fourmolu-plugin
25+
- ./plugins/hls-fourmolu-plugin
2626
- ./plugins/hls-pragmas-plugin
2727
- ./plugins/hls-module-name-plugin
2828
- ./plugins/hls-ormolu-plugin
@@ -38,6 +38,7 @@ extra-deps:
3838
- dependent-sum-0.7.1.0@sha256:0e419237f5b86da3659772afff9cab355c0f8d5b3fdb15a5b30e673d8dc83941,2147
3939
- extra-1.7.9
4040
- floskell-0.10.5
41+
- fourmolu-0.4.0.0
4142
- ghc-source-gen-0.4.1.0
4243
- heapsize-0.3.0.1@sha256:0b69aa97a46d819b700ac7b145f3b5493c3565cf2c5b8298682238d405d0326e,1417
4344
- hie-bios-0.7.6
@@ -104,7 +105,6 @@ flags:
104105
class: false
105106
tactic: false # Dependencies fail
106107

107-
fourmolu: false
108108
stylishHaskell: false
109109
brittany: false
110110
retrie:

0 commit comments

Comments
 (0)