Skip to content

Commit 625824d

Browse files
committed
hls-hlint-plugin & hls-stylish-haskell-plugin rush to ghc92
1 parent 2ced7aa commit 625824d

File tree

12 files changed

+83
-75
lines changed

12 files changed

+83
-75
lines changed

.github/workflows/test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ jobs:
190190
name: Test hls-splice-plugin
191191
run: cabal test hls-splice-plugin --test-options="$TEST_OPTS" || cabal test hls-splice-plugin --test-options="$TEST_OPTS" || LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true cabal test hls-splice-plugin --test-options="$TEST_OPTS"
192192

193-
- if: matrix.test && matrix.ghc != '9.0.1' && matrix.ghc != '9.0.2'
193+
- if: matrix.test
194194
name: Test hls-stylish-haskell-plugin
195195
run: cabal test hls-stylish-haskell-plugin --test-options="$TEST_OPTS" || cabal test hls-stylish-haskell-plugin --test-options="$TEST_OPTS" || LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true cabal test hls-stylish-haskell-plugin --test-options="$TEST_OPTS"
196196

@@ -222,7 +222,7 @@ jobs:
222222
name: Test hls-rename-plugin test suite
223223
run: cabal test hls-rename-plugin --test-options="$TEST_OPTS" || cabal test hls-rename-plugin --test-options="$TEST_OPTS" || LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true cabal test hls-rename-plugin --test-options="$TEST_OPTS"
224224

225-
- if: matrix.test && matrix.ghc != '9.2.2'
225+
- if: matrix.test
226226
name: Test hls-hlint-plugin test suite
227227
run: cabal test hls-hlint-plugin --test-options="$TEST_OPTS" || cabal test hls-hlint-plugin --test-options="$TEST_OPTS" || LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true cabal test hls-hlint-plugin --test-options="$TEST_OPTS"
228228

cabal-ghc90.project

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,10 @@ package *
3737

3838
write-ghc-environment-files: never
3939

40-
index-state: 2022-03-08T10:53:01Z
40+
index-state: 2022-04-25T10:14:27Z
4141

4242
constraints:
43-
-- These plugins don't work on GHC9 yet
44-
-- Add a plugin needs remove the -flag but also update ghc bounds in hls.cabal
45-
haskell-language-server +ignore-plugins-ghc-bounds -stylishhaskell,
46-
ghc-lib-parser ^>= 9.0
43+
hls-hlint-plugin +ghc-lib
4744

4845
-- although we are not building all plugins cabal solver phase is run for all packages
4946
-- this way we track explicitly all transitive dependencies which need support for ghc-9
@@ -57,10 +54,6 @@ allow-newer:
5754
-- https://github.com/lspitzner/butcher/pull/8
5855
butcher:base,
5956

60-
stylish-haskell:Cabal,
61-
stylish-haskell:ghc-lib-parser,
62-
stylish-haskell:aeson,
63-
6457
-- ghc-9.0.2 specific
6558
-- for ghcide:test via ghc-typelits-knownnat
6659
ghc-typelits-natnormalise:ghc-bignum

cabal-ghc92.project

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -39,18 +39,26 @@ package *
3939

4040
write-ghc-environment-files: never
4141

42-
index-state: 2022-04-19T07:18:40Z
42+
index-state: 2022-04-25T10:14:27Z
4343

4444
constraints:
4545
-- These plugins don't build/work on GHC92 yet
4646
haskell-language-server
4747
+ignore-plugins-ghc-bounds
4848
-brittany
4949
-haddockComments
50-
-hlint
5150
-retrie
5251
-splice
5352
-tactic,
53+
hls-hlint-plugin +ghc-lib,
54+
ghc-lib-parser-ex -auto,
55+
hlint +ghc-lib,
56+
stylish-haskell +ghc-lib
57+
58+
source-repository-package
59+
type: git
60+
location: https://github.com/July541/stylish-haskell.git
61+
tag: 305168551e0fe808e0c6ba14d8245680cdd6649d
5462

5563
allow-newer:
5664
-- for shake-bench
@@ -73,19 +81,6 @@ allow-newer:
7381
-- https://github.com/lspitzner/butcher/pull/8
7482
butcher:base,
7583

76-
ormolu:ghc-lib-parser,
77-
78-
fourmolu:ghc-lib-parser,
79-
fourmolu:Cabal,
80-
81-
hls-hlint-plugin:ghc-lib,
82-
hls-hlint-plugin:ghc-lib-parser,
83-
hls-hlint-plugin:ghc-lib-parser-ex,
84-
hlint:ghc-lib-parser,
85-
hlint:ghc-lib-parser-ex,
86-
-- See https://github.com/mpickering/apply-refact/pull/116
87-
apply-refact:base,
88-
8984
implicit-hie-cradle:bytestring,
9085
implicit-hie-cradle:time,
9186

@@ -95,7 +90,8 @@ allow-newer:
9590
-- for ghcide:test via ghc-typelits-knownnat
9691
ghc-typelits-natnormalise:ghc-bignum,
9792

98-
hiedb:base
93+
hiedb:base,
94+
retrie:ghc-exactprint
9995

10096
allow-older:
10197
primitive-extras:primitive-unlifted

haskell-language-server.cabal

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ common example-plugins
224224
Ide.Plugin.Example2
225225

226226
common class
227-
if flag(class) && (impl(ghc < 9.2.1) || flag(ignore-plugins-ghc-bounds))
227+
if flag(class)
228228
build-depends: hls-class-plugin ^>= 1.0
229229
cpp-options: -Dclass
230230

@@ -269,7 +269,7 @@ common tactic
269269
cpp-options: -Dtactic
270270

271271
common hlint
272-
if flag(hlint) && (impl(ghc < 9.2.1) || flag(ignore-plugins-ghc-bounds))
272+
if flag(hlint)
273273
build-depends: hls-hlint-plugin ^>= 1.0
274274
cpp-options: -Dhlint
275275

@@ -326,7 +326,7 @@ common ormolu
326326
cpp-options: -Dormolu
327327

328328
common stylishHaskell
329-
if flag(stylishHaskell) && (impl(ghc < 9.0.1) || flag(ignore-plugins-ghc-bounds))
329+
if flag(stylishHaskell)
330330
build-depends: hls-stylish-haskell-plugin ^>= 1.0
331331
cpp-options: -DstylishHaskell
332332

plugins/hls-class-plugin/src/Ide/Plugin/Class.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ addMethodPlaceholders state AddMinimalMethodsParams{..} = do
128128
addWhere decl = decl
129129

130130
newLine (L l e) =
131-
let dp = deltaPos 1 (indent + 1) -- Not sure why there need one more space
131+
let dp = deltaPos 1 indent
132132
in L (noAnnSrcSpanDP (locA l) dp <> l) e
133133

134134
#else

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ library
2323
build-depends:
2424
, base >=4.12 && <5
2525
, filepath
26-
, fourmolu ^>=0.3 || ^>=0.4 || ^>= 0.5
26+
, fourmolu ^>=0.3 || ^>=0.4 || ^>= 0.6
2727
, ghc
2828
, ghc-boot-th
2929
, ghcide ^>=1.7

plugins/hls-hlint-plugin/hls-hlint-plugin.cabal

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ library
4343
hs-source-dirs: src
4444
build-depends:
4545
, aeson
46-
, apply-refact >=0.9.3.0
4746
, base >=4.12 && <5
4847
, binary
4948
, bytestring
@@ -78,21 +77,28 @@ library
7877
-- This mirrors the logic in hlint.cabal for hlint-3.3
7978
-- https://github.com/ndmitchell/hlint/blob/d3576de4529d8df6cca5a345f5b7e04474ff7bff/hlint.cabal#L79-L88
8079
-- so we can make sure that we do the same thing as hlint
81-
build-depends: hlint ^>=3.3
80+
build-depends: hlint ^>=3.4
81+
8282
if (!flag(ghc-lib) && impl(ghc >=9.0.1) && impl(ghc <9.1.0))
83-
build-depends: ghc ==9.0.*
83+
build-depends: ghc ==9.0.*
84+
, apply-refact >=0.9.0.0
85+
elif (!flag(ghc-lib) && impl(ghc >=9.2.1) && impl(ghc <9.3.0))
86+
build-depends: ghc ==9.2.*
87+
, apply-refact >=0.10.0.0
8488
else
8589
build-depends:
86-
, ghc
87-
, ghc-lib ^>=9.0
88-
, ghc-lib-parser-ex ^>=9.0
90+
, ghc-lib ^>=9.2
91+
, ghc-lib-parser-ex ^>=9.2
92+
, ghc-lib-parser ^>=9.2
93+
, apply-refact >=0.9.0.0
8994

9095
cpp-options: -DHLINT_ON_GHC_LIB
9196

9297
else
9398
-- This mirrors the logic in hlint.cabal for hlint-3.2
9499
-- https://github.com/ndmitchell/hlint/blob/c7354e473c7d09213c8adc3dc94bf50a6eb4a42d/hlint.cabal#L79-L88
95100
build-depends: hlint ^>=3.2
101+
, apply-refact >=0.9.3.0
96102
if (!flag(ghc-lib) && impl(ghc >=8.10.1) && impl(ghc < 8.11.0))
97103
build-depends: ghc >=8.10 && <9.0
98104
else

plugins/hls-hlint-plugin/src/Ide/Plugin/Hlint.hs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,7 @@ import qualified Refact.Apply as Refact
6060
import qualified Refact.Types as Refact
6161

6262
#ifdef HLINT_ON_GHC_LIB
63-
import Development.IDE.GHC.Compat (BufSpan,
64-
DynFlags,
63+
import Development.IDE.GHC.Compat (DynFlags,
6564
WarningFlag (Opt_WarnUnrecognisedPragmas),
6665
extensionFlags,
6766
ms_hspp_opts,
@@ -73,6 +72,7 @@ import "ghc-lib" GHC hiding
7372
RealSrcSpan,
7473
ms_hspp_opts)
7574
import qualified "ghc-lib" GHC
75+
import "ghc-lib" GHC.Types.SrcLoc (BufSpan)
7676
import "ghc-lib-parser" GHC.LanguageExtensions (Extension)
7777
import Language.Haskell.GhclibParserEx.GHC.Driver.Session as GhclibParserEx (readExtension)
7878
import System.FilePath (takeFileName)
@@ -89,7 +89,11 @@ import System.IO.Temp
8989
import Development.IDE.GHC.Compat hiding
9090
(setEnv, (<+>))
9191
import GHC.Generics (Associativity (LeftAssociative, NotAssociative, RightAssociative))
92+
#if MIN_GHC_API_VERSION(9,2,0)
93+
import Language.Haskell.GHC.ExactPrint.ExactPrint (deltaOptions)
94+
#else
9295
import Language.Haskell.GHC.ExactPrint.Delta (deltaOptions)
96+
#endif
9397
import Language.Haskell.GHC.ExactPrint.Parsers (postParseTransform)
9498
import Language.Haskell.GHC.ExactPrint.Types (Rigidity (..))
9599
import Language.Haskell.GhclibParserEx.Fixity as GhclibParserEx (applyFixities)
@@ -141,12 +145,12 @@ instance Pretty Log where
141145
LogApplying fp res -> "Applying hint(s) for" <+> viaShow fp <> ":" <+> viaShow res
142146
LogGeneratedIdeas fp ideas -> "Generated hlint ideas for for" <+> viaShow fp <> ":" <+> viaShow ideas
143147
LogUsingExtensions fp exts -> "Using extensions for " <+> viaShow fp <> ":" <+> pretty exts
144-
LogGetIdeas fp -> "Getting hlint ideas for " <+> viaShow fp
148+
LogGetIdeas fp -> "Getting hlint ideas for " <+> viaShow fp
145149

146150
#ifdef HLINT_ON_GHC_LIB
147151
-- Reimplementing this, since the one in Development.IDE.GHC.Compat isn't for ghc-lib
148152
pattern RealSrcSpan :: GHC.RealSrcSpan -> Maybe BufSpan -> GHC.SrcSpan
149-
#if MIN_VERSION_ghc(9,0,0)
153+
#if MIN_GHC_API_VERSION(9,0,0)
150154
pattern RealSrcSpan x y = GHC.RealSrcSpan x y
151155
#else
152156
pattern RealSrcSpan x y <- ((,Nothing) -> (GHC.RealSrcSpan x, y))
@@ -323,8 +327,7 @@ getExtensions nfp = do
323327
dflags <- getFlags
324328
let hscExts = EnumSet.toList (extensionFlags dflags)
325329
let hscExts' = mapMaybe (GhclibParserEx.readExtension . show) hscExts
326-
let hlintExts = hscExts'
327-
return hlintExts
330+
return hscExts'
328331
where getFlags :: Action DynFlags
329332
getFlags = do
330333
modsum <- use_ GetModSummary nfp

plugins/hls-hlint-plugin/test/Main.hs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,8 @@ suggestionsTests =
181181
doc <- openDoc "IgnoreAnnHlint.hs" "haskell"
182182
expectNoMoreDiagnostics 3 doc "hlint"
183183

184-
, testCase "apply-refact preserve regular comments" $ runHlintSession "" $ do
184+
, knownBrokenForGhcVersions [GHC92] "apply-refact has different behavior on v0.10.0.0" $
185+
testCase "apply-refact preserve regular comments" $ runHlintSession "" $ do
185186
testRefactor "Comments.hs" "Redundant bracket" expectedComments
186187

187188
, testCase "[#2290] apply all hints works with a trailing comment" $ runHlintSession "" $ do
@@ -358,10 +359,7 @@ disableHlint = sendConfigurationChanged $ toJSON $ def { Plugin.plugins = Map.fr
358359
-- Although a given hlint version supports one direct ghc, we could use several versions of hlint
359360
-- each one supporting a different ghc version. It should be a temporary situation though.
360361
knownBrokenForHlintOnGhcLib :: String -> TestTree -> TestTree
361-
knownBrokenForHlintOnGhcLib = knownBrokenForGhcVersions [GHC88, GHC86]
362-
363-
knownBrokenForHlintOnRawGhc :: String -> TestTree -> TestTree
364-
knownBrokenForHlintOnRawGhc = knownBrokenForGhcVersions [GHC810, GHC90]
362+
knownBrokenForHlintOnGhcLib = knownBrokenForGhcVersions [GHC86, GHC88, GHC90, GHC92]
365363

366364
-- 1's based
367365
data Point = Point {

stack-9.0.1.yaml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ packages:
2121
- ./plugins/hls-splice-plugin
2222
- ./plugins/hls-tactics-plugin
2323
- ./plugins/hls-brittany-plugin
24-
# - ./plugins/hls-stylish-haskell-plugin
24+
- ./plugins/hls-stylish-haskell-plugin
2525
- ./plugins/hls-floskell-plugin
2626
- ./plugins/hls-fourmolu-plugin
2727
- ./plugins/hls-pragmas-plugin
@@ -56,6 +56,13 @@ extra-deps:
5656
- lsp-types-1.4.0.1
5757
- lsp-test-0.14.0.2
5858
- refinery-0.4.0.0
59+
- ghc-lib-9.2.2.20220307
60+
- ghc-lib-parser-9.2.2.20220307
61+
- ghc-lib-parser-ex-9.2.0.3
62+
- hlint-3.4
63+
- stylish-haskell-0.14.1.0
64+
- ormolu-0.4.0.0
65+
- fourmolu-0.6.0.0
5966

6067
# shake-bench dependencies
6168
- Chart-1.9.3
@@ -65,9 +72,6 @@ extra-deps:
6572
- statestack-0.3
6673
- operational-0.2.4.1
6774

68-
# currently needed for ghcide>extra, etc.
69-
allow-newer: true
70-
7175
ghc-options:
7276
"$everything": -haddock
7377

@@ -82,15 +86,11 @@ configure-options:
8286
flags:
8387
haskell-language-server:
8488
pedantic: true
85-
86-
ignore-plugins-ghc-bounds: true
87-
stylishHaskell: false
88-
8989
retrie:
9090
BuildExecutable: false
91-
# Stack doesn't support automatic flags.
9291
hls-hlint-plugin:
9392
hlint33: true
93+
ghc-lib: true
9494
hyphenation:
9595
embed: true
9696

stack-9.0.2.yaml

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ packages:
2121
- ./plugins/hls-splice-plugin
2222
- ./plugins/hls-tactics-plugin
2323
- ./plugins/hls-brittany-plugin
24-
# - ./plugins/hls-stylish-haskell-plugin
24+
- ./plugins/hls-stylish-haskell-plugin
2525
- ./plugins/hls-floskell-plugin
2626
- ./plugins/hls-fourmolu-plugin
2727
- ./plugins/hls-pragmas-plugin
@@ -57,6 +57,13 @@ extra-deps:
5757
- lsp-types-1.4.0.1
5858
- lsp-test-0.14.0.2
5959
- unix-compat-0.5.4
60+
- ghc-lib-9.2.2.20220307
61+
- ghc-lib-parser-9.2.2.20220307
62+
- ghc-lib-parser-ex-9.2.0.3
63+
- hlint-3.4
64+
- stylish-haskell-0.14.1.0
65+
- ormolu-0.4.0.0
66+
- fourmolu-0.6.0.0
6067

6168
# shake-bench dependencies
6269
- Chart-1.9.3
@@ -80,16 +87,13 @@ extra-deps:
8087
- ghc-typelits-natnormalise-0.7.6
8188

8289
# boot libraries
83-
- Cabal-3.4.1.0
90+
- Cabal-3.6.0.0
8491
- directory-1.3.6.2
8592
- process-1.6.13.2
8693
- time-1.9.3
8794
- unix-2.7.2.2
8895
- Win32-2.12.0.1
8996

90-
# currently needed for ghcide>extra, etc.
91-
allow-newer: true
92-
9397
ghc-options:
9498
"$everything": -haddock
9599

@@ -104,15 +108,12 @@ configure-options:
104108
flags:
105109
haskell-language-server:
106110
pedantic: true
107-
108-
ignore-plugins-ghc-bounds: true
109-
stylishHaskell: false
110-
111111
retrie:
112112
BuildExecutable: false
113113
# Stack doesn't support automatic flags.
114114
hls-hlint-plugin:
115115
hlint33: true
116+
ghc-lib: true
116117
hyphenation:
117118
embed: true
118119

0 commit comments

Comments
 (0)