Skip to content

Commit bf6a4aa

Browse files
committed
Enable fourmolu and ormolu for GHC 9.12
1 parent 53bf92c commit bf6a4aa

File tree

8 files changed

+88
-29
lines changed

8 files changed

+88
-29
lines changed

.github/workflows/test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,11 +169,11 @@ jobs:
169169
name: Test hls-stylish-haskell-plugin
170170
run: cabal test hls-stylish-haskell-plugin-tests || cabal test hls-stylish-haskell-plugin-tests
171171

172-
- if: matrix.test && matrix.ghc != '9.12'
172+
- if: matrix.test
173173
name: Test hls-ormolu-plugin
174174
run: cabal test hls-ormolu-plugin-tests || cabal test hls-ormolu-plugin-tests
175175

176-
- if: matrix.test && matrix.ghc != '9.12'
176+
- if: matrix.test
177177
name: Test hls-fourmolu-plugin
178178
run: cabal test hls-fourmolu-plugin-tests || cabal test hls-fourmolu-plugin-tests
179179

cabal.project

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,11 @@ constraints:
4444
bitvec -simd,
4545

4646

47-
if impl(ghc >= 9.8.4) && impl(ghc < 9.8.5)
48-
-- By depending on ghc-lib-parser and ghc, we are encountering
49-
-- a constraint conflict, ghc-9.8.4 comes with `filepath-1.4.301.0`,
50-
-- and `ghc-lib-parser-9.8.4.20241130` specifies `filepath >=1.5 && < 1.6.
51-
-- See https://github.com/digital-asset/ghc-lib/issues/572 for details.
52-
allow-older:
53-
ghc-lib-parser:filepath
54-
constraints:
55-
ghc-lib-parser==9.8.4.20241130
47+
-- Some of the parser need the latest Cabal-syntax version,
48+
-- but 'cabal-install-parsers-0.6.2' only has Cabal-syntax (>=3.12.0.0 && <3.13).
49+
-- So, we relax the upper bounds here.
50+
allow-newer:
51+
cabal-install-parsers:Cabal-syntax,
5652

5753
if impl(ghc >= 9.11)
5854
benchmarks: False

docs/support/plugin-support.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,13 @@ For example, a plugin to provide a formatter which has itself been abandoned has
5353
| `hls-eval-plugin` | 2 | |
5454
| `hls-explicit-fixity-plugin` | 2 | |
5555
| `hls-explicit-record-fields-plugin` | 2 | |
56-
| `hls-fourmolu-plugin` | 2 | 9.12.2 |
56+
| `hls-fourmolu-plugin` | 2 | |
5757
| `hls-gadt-plugin` | 2 | 9.12.2 |
5858
| `hls-hlint-plugin` | 2 | 9.10.1, 9.12.2 |
5959
| `hls-module-name-plugin` | 2 | |
6060
| `hls-notes-plugin` | 2 | |
6161
| `hls-qualify-imported-names-plugin` | 2 | |
62-
| `hls-ormolu-plugin` | 2 | 9.12.2 |
62+
| `hls-ormolu-plugin` | 2 | |
6363
| `hls-rename-plugin` | 2 | |
6464
| `hls-stylish-haskell-plugin` | 2 | 9.10.1, 9.12.2 |
6565
| `hls-overloaded-record-dot-plugin` | 2 | |

haskell-language-server.cabal

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1442,19 +1442,19 @@ flag fourmolu
14421442
manual: True
14431443

14441444
common fourmolu
1445-
if flag(fourmolu) && (impl(ghc < 9.11) || flag(ignore-plugins-ghc-bounds))
1445+
if flag(fourmolu)
14461446
build-depends: haskell-language-server:hls-fourmolu-plugin
14471447
cpp-options: -Dhls_fourmolu
14481448

14491449
library hls-fourmolu-plugin
14501450
import: defaults, pedantic, warnings
1451-
if !flag(fourmolu) || (impl(ghc > 9.11) && !flag(ignore-plugins-ghc-bounds))
1451+
if !flag(fourmolu)
14521452
buildable: False
14531453
exposed-modules: Ide.Plugin.Fourmolu
14541454
hs-source-dirs: plugins/hls-fourmolu-plugin/src
14551455
build-depends:
14561456
, filepath
1457-
, fourmolu ^>= 0.14 || ^>= 0.15 || ^>= 0.16
1457+
, fourmolu ^>= 0.14 || ^>= 0.15 || ^>= 0.16 || ^>=0.17 || ^>=0.18
14581458
, ghc-boot-th
14591459
, ghcide == 2.10.0.0
14601460
, hls-plugin-api == 2.10.0.0
@@ -1468,7 +1468,7 @@ library hls-fourmolu-plugin
14681468

14691469
test-suite hls-fourmolu-plugin-tests
14701470
import: defaults, pedantic, test-defaults, warnings
1471-
if !flag(fourmolu) || (impl(ghc > 9.11) && !flag(ignore-plugins-ghc-bounds))
1471+
if !flag(fourmolu)
14721472
buildable: False
14731473
type: exitcode-stdio-1.0
14741474
hs-source-dirs: plugins/hls-fourmolu-plugin/test
@@ -1496,13 +1496,13 @@ flag ormolu
14961496
manual: True
14971497

14981498
common ormolu
1499-
if flag(ormolu) && (impl(ghc < 9.11) || flag(ignore-plugins-ghc-bounds))
1499+
if flag(ormolu)
15001500
build-depends: haskell-language-server:hls-ormolu-plugin
15011501
cpp-options: -Dhls_ormolu
15021502

15031503
library hls-ormolu-plugin
15041504
import: defaults, pedantic, warnings
1505-
if !flag(ormolu) || (impl(ghc > 9.11) && !flag(ignore-plugins-ghc-bounds))
1505+
if !flag(ormolu)
15061506
buildable: False
15071507
exposed-modules: Ide.Plugin.Ormolu
15081508
hs-source-dirs: plugins/hls-ormolu-plugin/src
@@ -1515,14 +1515,14 @@ library hls-ormolu-plugin
15151515
, lsp
15161516
, mtl
15171517
, process-extras >= 0.7.1
1518-
, ormolu ^>=0.1.2 || ^>= 0.2 || ^>= 0.3 || ^>= 0.5 || ^>= 0.6 || ^>= 0.7
1518+
, ormolu ^>=0.5.3 || ^>= 0.6 || ^>= 0.7 || ^>=0.8
15191519
, text
15201520
, transformers
15211521

15221522

15231523
test-suite hls-ormolu-plugin-tests
15241524
import: defaults, pedantic, test-defaults, warnings
1525-
if !flag(ormolu) || (impl(ghc > 9.11) && !flag(ignore-plugins-ghc-bounds))
1525+
if !flag(ormolu)
15261526
buildable: False
15271527
type: exitcode-stdio-1.0
15281528
hs-source-dirs: plugins/hls-ormolu-plugin/test
@@ -2009,9 +2009,9 @@ test-suite func-test
20092009
-- formatters
20102010
if flag(floskell) && (impl(ghc < 9.10) || flag(ignore-plugins-ghc-bounds))
20112011
cpp-options: -Dhls_floskell
2012-
if flag(fourmolu) && (impl(ghc < 9.11) || flag(ignore-plugins-ghc-bounds))
2012+
if flag(fourmolu)
20132013
cpp-options: -Dhls_fourmolu
2014-
if flag(ormolu) && (impl(ghc < 9.11) || flag(ignore-plugins-ghc-bounds))
2014+
if flag(ormolu)
20152015
cpp-options: -Dhls_ormolu
20162016

20172017
test-suite wrapper-test

plugins/hls-fourmolu-plugin/test/testdata/Fourmolu.formatted.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ foo 3 = 2
1010
foo x = x
1111
bar :: String -> IO String
1212
bar s = do
13-
x <- return "hello"
14-
return "asdf"
13+
x <- return "hello"
14+
return "asdf"
1515

1616
data Baz = Baz {a :: Int, b :: String}
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
b :: Bool
22
b =
3+
id $
34
id $
4-
id $
5-
case True && True of
6-
True -> True
7-
False -> False
5+
case True && True of
6+
True -> True
7+
False -> False

test/testdata/schema/ghc912/default-config.golden.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,12 @@
4747
"explicit-fixity": {
4848
"globalOn": true
4949
},
50+
"fourmolu": {
51+
"config": {
52+
"external": false,
53+
"path": "fourmolu"
54+
}
55+
},
5056
"ghcide-code-actions-bindings": {
5157
"globalOn": true
5258
},
@@ -76,6 +82,13 @@
7682
},
7783
"globalOn": true
7884
},
85+
"hlint": {
86+
"codeActionsOn": true,
87+
"config": {
88+
"flags": []
89+
},
90+
"diagnosticsOn": true
91+
},
7992
"importLens": {
8093
"codeActionsOn": true,
8194
"codeLensOn": true,
@@ -84,6 +97,11 @@
8497
"moduleName": {
8598
"globalOn": true
8699
},
100+
"ormolu": {
101+
"config": {
102+
"external": false
103+
}
104+
},
87105
"overloaded-record-dot": {
88106
"globalOn": true
89107
},
@@ -122,6 +140,9 @@
122140
"variableToken": "variable"
123141
},
124142
"globalOn": false
143+
},
144+
"stan": {
145+
"globalOn": false
125146
}
126147
},
127148
"sessionLoading": "singleComponent"

test/testdata/schema/ghc912/vscode-extension-schema.golden.json

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,18 @@
107107
"scope": "resource",
108108
"type": "boolean"
109109
},
110+
"haskell.plugin.fourmolu.config.external": {
111+
"default": false,
112+
"markdownDescription": "Call out to an external \"fourmolu\" executable, rather than using the bundled library.",
113+
"scope": "resource",
114+
"type": "boolean"
115+
},
116+
"haskell.plugin.fourmolu.config.path": {
117+
"default": "fourmolu",
118+
"markdownDescription": "Set path to executable (for \"external\" mode).",
119+
"scope": "resource",
120+
"type": "string"
121+
},
110122
"haskell.plugin.ghcide-code-actions-bindings.globalOn": {
111123
"default": true,
112124
"description": "Enables ghcide-code-actions-bindings plugin",
@@ -183,6 +195,24 @@
183195
"scope": "resource",
184196
"type": "boolean"
185197
},
198+
"haskell.plugin.hlint.codeActionsOn": {
199+
"default": true,
200+
"description": "Enables hlint code actions",
201+
"scope": "resource",
202+
"type": "boolean"
203+
},
204+
"haskell.plugin.hlint.config.flags": {
205+
"default": [],
206+
"markdownDescription": "Flags used by hlint",
207+
"scope": "resource",
208+
"type": "array"
209+
},
210+
"haskell.plugin.hlint.diagnosticsOn": {
211+
"default": true,
212+
"description": "Enables hlint diagnostics",
213+
"scope": "resource",
214+
"type": "boolean"
215+
},
186216
"haskell.plugin.importLens.codeActionsOn": {
187217
"default": true,
188218
"description": "Enables importLens code actions",
@@ -207,6 +237,12 @@
207237
"scope": "resource",
208238
"type": "boolean"
209239
},
240+
"haskell.plugin.ormolu.config.external": {
241+
"default": false,
242+
"markdownDescription": "Call out to an external \"ormolu\" executable, rather than using the bundled library",
243+
"scope": "resource",
244+
"type": "boolean"
245+
},
210246
"haskell.plugin.overloaded-record-dot.globalOn": {
211247
"default": true,
212248
"description": "Enables overloaded-record-dot plugin",
@@ -982,5 +1018,11 @@
9821018
"description": "Enables semanticTokens plugin",
9831019
"scope": "resource",
9841020
"type": "boolean"
1021+
},
1022+
"haskell.plugin.stan.globalOn": {
1023+
"default": false,
1024+
"description": "Enables stan plugin",
1025+
"scope": "resource",
1026+
"type": "boolean"
9851027
}
9861028
}

0 commit comments

Comments
 (0)