Skip to content

Commit 70e6c68

Browse files
authored
Merge branch 'master' into patch-2
2 parents 24516a0 + a941fb7 commit 70e6c68

File tree

19 files changed

+522
-123
lines changed

19 files changed

+522
-123
lines changed

.circleci/config.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,14 @@ version: 2
6060
jobs:
6161
stackage-lts22:
6262
docker:
63-
- image: haskell:9.6.5-slim-buster
63+
- image: haskell:9.6.6-slim-bullseye
6464
environment:
6565
- STACK_FILE: "stack-lts22.yaml"
6666
<<: *defaults
6767

68-
stackage-nightly:
68+
stackage-lts23:
6969
docker:
70-
- image: haskell:9.8.2-slim-buster
70+
- image: haskell:9.8.4-slim-bullseye
7171
environment:
7272
- STACK_FILE: "stack.yaml"
7373
<<: *defaults
@@ -77,4 +77,4 @@ workflows:
7777
multiple-ghcs:
7878
jobs:
7979
- stackage-lts22
80-
- stackage-nightly
80+
- stackage-lts23

.github/workflows/test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ jobs:
134134
HLS_WRAPPER_TEST_EXE: hls-wrapper
135135
run: cabal test wrapper-test
136136

137-
- if: matrix.test && matrix.ghc != '9.12'
137+
- if: matrix.test
138138
name: Test hls-refactor-plugin
139139
run: cabal test hls-refactor-plugin-tests || cabal test hls-refactor-plugin-tests
140140

@@ -185,7 +185,7 @@ jobs:
185185
name: Test hls-call-hierarchy-plugin test suite
186186
run: cabal test hls-call-hierarchy-plugin-tests || cabal test hls-call-hierarchy-plugin-tests
187187

188-
- if: matrix.test && matrix.os != 'windows-latest' && matrix.ghc != '9.12'
188+
- if: matrix.test && matrix.os != 'windows-latest'
189189
name: Test hls-rename-plugin test suite
190190
run: cabal test hls-rename-plugin-tests || cabal test hls-rename-plugin-tests
191191

cabal.project

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ packages:
88
./hls-test-utils
99

1010

11-
index-state: 2025-03-20T00:00:00Z
11+
index-state: 2025-04-08T01:30:37Z
1212

1313
tests: True
1414
test-show-details: direct
@@ -57,8 +57,6 @@ if impl(ghc >= 9.8.4) && impl(ghc < 9.8.5)
5757
if impl(ghc >= 9.11)
5858
benchmarks: False
5959
allow-newer:
60-
hiedb:base,
61-
hiedb:ghc,
6260
hie-bios:ghc,
6361
ghc-trace-events:base,
6462
tasty-hspec:base,

docs/configuration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ Plugins have a generic config to control their behaviour. The schema of such con
6161
- `haskell.plugin.eval.config.diff`, default true: When reloading haddock test results in changes, mark it with WAS/NOW.
6262
- `haskell.plugin.eval.config.exception`, default false: When the command results in an exception, mark it with `*** Exception:`.
6363
- `rename`:
64-
- `haskell.plugin.rename.config.diff`, default false: Enables renaming across modules (experimental)
64+
- `haskell.plugin.rename.config.crossModule`, default false: Enables renaming across modules (experimental)
6565
- `ghcide-completions`:
6666
- `haskell.plugin.ghcide-completions.config.snippetsOn`, default true: Inserts snippets when using code completions.
6767
- `haskell.plugin.ghcide-completions.config.autoExtendOn`, default true: Extends the import list automatically when completing a out-of-scope identifier.

docs/support/plugin-support.md

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -37,34 +37,34 @@ For example, a plugin to provide a formatter which has itself been abandoned has
3737

3838
## Current plugin support tiers
3939

40-
| Plugin | Tier | Unsupported GHC versions |
41-
| ----------------------------------- | ---- | ------------------------ |
42-
| ghcide core plugins | 1 | |
43-
| `hls-call-hierarchy-plugin` | 1 | |
44-
| `hls-code-range-plugin` | 1 | |
45-
| `hls-explicit-imports-plugin` | 1 | |
46-
| `hls-pragmas-plugin` | 1 | |
47-
| `hls-refactor-plugin` | 1 | |
48-
| `hls-alternate-number-plugin` | 2 | |
49-
| `hls-cabal-fmt-plugin` | 2 | |
50-
| `hls-cabal-gild-plugin` | 2 | |
51-
| `hls-class-plugin` | 2 | |
52-
| `hls-change-type-signature-plugin` | 2 | |
53-
| `hls-eval-plugin` | 2 | |
54-
| `hls-explicit-fixity-plugin` | 2 | |
55-
| `hls-explicit-record-fields-plugin` | 2 | |
56-
| `hls-fourmolu-plugin` | 2 | |
57-
| `hls-gadt-plugin` | 2 | |
58-
| `hls-hlint-plugin` | 2 | 9.10.1 |
59-
| `hls-module-name-plugin` | 2 | |
60-
| `hls-notes-plugin` | 2 | |
61-
| `hls-qualify-imported-names-plugin` | 2 | |
62-
| `hls-ormolu-plugin` | 2 | |
63-
| `hls-rename-plugin` | 2 | |
64-
| `hls-stylish-haskell-plugin` | 2 | 9.10.1 |
65-
| `hls-overloaded-record-dot-plugin` | 2 | |
66-
| `hls-semantic-tokens-plugin` | 2 | |
67-
| `hls-floskell-plugin` | 3 | 9.10.1 |
68-
| `hls-stan-plugin` | 3 | |
69-
| `hls-retrie-plugin` | 3 | 9.10.1 |
70-
| `hls-splice-plugin` | 3 | 9.10.1 |
40+
| Plugin | Tier | Unsupported GHC versions |
41+
| ------------------------------------ | ---- | ------------------------ |
42+
| ghcide core plugins | 1 | |
43+
| `hls-call-hierarchy-plugin` | 1 | |
44+
| `hls-code-range-plugin` | 1 | |
45+
| `hls-explicit-imports-plugin` | 1 | |
46+
| `hls-pragmas-plugin` | 1 | |
47+
| `hls-refactor-plugin` | 2 | 9.12.2 |
48+
| `hls-alternate-number-format-plugin` | 2 | |
49+
| `hls-cabal-fmt-plugin` | 2 | |
50+
| `hls-cabal-gild-plugin` | 2 | |
51+
| `hls-class-plugin` | 2 | |
52+
| `hls-change-type-signature-plugin` | 2 | |
53+
| `hls-eval-plugin` | 2 | |
54+
| `hls-explicit-fixity-plugin` | 2 | |
55+
| `hls-explicit-record-fields-plugin` | 2 | |
56+
| `hls-fourmolu-plugin` | 2 | 9.12.2 |
57+
| `hls-gadt-plugin` | 2 | 9.12.2 |
58+
| `hls-hlint-plugin` | 2 | 9.10.1, 9.12.2 |
59+
| `hls-module-name-plugin` | 2 | |
60+
| `hls-notes-plugin` | 2 | |
61+
| `hls-qualify-imported-names-plugin` | 2 | |
62+
| `hls-ormolu-plugin` | 2 | 9.12.2 |
63+
| `hls-rename-plugin` | 2 | |
64+
| `hls-stylish-haskell-plugin` | 2 | 9.10.1, 9.12.2 |
65+
| `hls-overloaded-record-dot-plugin` | 2 | |
66+
| `hls-semantic-tokens-plugin` | 2 | |
67+
| `hls-floskell-plugin` | 3 | 9.10.1, 9.12.2 |
68+
| `hls-stan-plugin` | 3 | 9.12.2 |
69+
| `hls-retrie-plugin` | 3 | 9.10.1, 9.12.2 |
70+
| `hls-splice-plugin` | 3 | 9.10.1, 9.12.2 |

ghcide/ghcide.cabal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ library
7575
, hashable
7676
, hie-bios ^>=0.14.0
7777
, hie-compat ^>=0.3.0.0
78-
, hiedb ^>= 0.6.0.0
78+
, hiedb ^>= 0.6.0.2
7979
, hls-graph == 2.10.0.0
8080
, hls-plugin-api == 2.10.0.0
8181
, implicit-hie >= 0.1.4.0 && < 0.1.5

haskell-language-server.cabal

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ flag cabalfmt
117117
manual: True
118118

119119
common cabalfmt
120-
if flag(cabalfmt)
120+
if flag(cabalfmt) && flag(cabal)
121121
build-depends: haskell-language-server:hls-cabal-fmt-plugin
122122
cpp-options: -Dhls_cabalfmt
123123

@@ -129,7 +129,7 @@ flag isolateCabalfmtTests
129129

130130
library hls-cabal-fmt-plugin
131131
import: defaults, pedantic, warnings
132-
if !flag(cabalfmt)
132+
if !flag(cabalfmt) || !flag(cabal)
133133
buildable: False
134134
exposed-modules: Ide.Plugin.CabalFmt
135135
hs-source-dirs: plugins/hls-cabal-fmt-plugin/src
@@ -174,7 +174,7 @@ flag cabalgild
174174
manual: True
175175

176176
common cabalgild
177-
if flag(cabalgild) && (impl(ghc < 9.11) || flag(ignore-plugins-ghc-bounds))
177+
if flag(cabalgild) && flag(cabal)
178178
build-depends: haskell-language-server:hls-cabal-gild-plugin
179179
cpp-options: -Dhls_cabalgild
180180

@@ -186,7 +186,7 @@ flag isolateCabalGildTests
186186

187187
library hls-cabal-gild-plugin
188188
import: defaults, pedantic, warnings
189-
if !flag(cabalgild) || (impl(ghc > 9.11) && !flag(ignore-plugins-ghc-bounds))
189+
if !flag(cabalgild) || !flag(cabal)
190190
buildable: False
191191
exposed-modules: Ide.Plugin.CabalGild
192192
hs-source-dirs: plugins/hls-cabal-gild-plugin/src
@@ -203,7 +203,7 @@ library hls-cabal-gild-plugin
203203
-- The `hls-cabal-plugin` is needed for tests, as we need to install notification handlers
204204
test-suite hls-cabal-gild-plugin-tests
205205
import: defaults, pedantic, test-defaults, warnings
206-
if !flag(cabalgild) || !flag(cabal) || (impl(ghc > 9.11) && !flag(ignore-plugins-ghc-bounds))
206+
if !flag(cabalgild) || !flag(cabal)
207207
buildable: False
208208
type: exitcode-stdio-1.0
209209
hs-source-dirs: plugins/hls-cabal-gild-plugin/test
@@ -407,7 +407,7 @@ library hls-call-hierarchy-plugin
407407
, containers
408408
, extra
409409
, ghcide == 2.10.0.0
410-
, hiedb ^>= 0.6.0.0
410+
, hiedb ^>= 0.6.0.2
411411
, hls-plugin-api == 2.10.0.0
412412
, lens
413413
, lsp >=2.7
@@ -580,21 +580,21 @@ flag rename
580580
manual: True
581581

582582
common rename
583-
if flag(rename) && (impl(ghc < 9.11) || flag(ignore-plugins-ghc-bounds))
583+
if flag(rename)
584584
build-depends: haskell-language-server:hls-rename-plugin
585585
cpp-options: -Dhls_rename
586586

587587
library hls-rename-plugin
588588
import: defaults, pedantic, warnings
589-
if !flag(rename) || (impl(ghc > 9.11) && !flag(ignore-plugins-ghc-bounds))
589+
if !flag(rename)
590590
buildable: False
591591
exposed-modules: Ide.Plugin.Rename
592592
hs-source-dirs: plugins/hls-rename-plugin/src
593593
build-depends:
594594
, containers
595595
, ghcide == 2.10.0.0
596596
, hashable
597-
, hiedb ^>= 0.6.0.0
597+
, hiedb ^>= 0.6.0.2
598598
, hie-compat
599599
, hls-plugin-api == 2.10.0.0
600600
, haskell-language-server:hls-refactor-plugin
@@ -610,7 +610,7 @@ library hls-rename-plugin
610610

611611
test-suite hls-rename-plugin-tests
612612
import: defaults, pedantic, test-defaults, warnings
613-
if !flag(rename) || (impl(ghc > 9.11) && !flag(ignore-plugins-ghc-bounds))
613+
if !flag(rename)
614614
buildable: False
615615
type: exitcode-stdio-1.0
616616
hs-source-dirs: plugins/hls-rename-plugin/test
@@ -1596,13 +1596,13 @@ flag refactor
15961596
manual: True
15971597

15981598
common refactor
1599-
if flag(refactor) && (impl(ghc < 9.11) || flag(ignore-plugins-ghc-bounds))
1599+
if flag(refactor)
16001600
build-depends: haskell-language-server:hls-refactor-plugin
16011601
cpp-options: -Dhls_refactor
16021602

16031603
library hls-refactor-plugin
16041604
import: defaults, pedantic, warnings
1605-
if !flag(refactor) || (impl(ghc > 9.11) && !flag(ignore-plugins-ghc-bounds))
1605+
if !flag(refactor)
16061606
buildable: False
16071607
exposed-modules: Development.IDE.GHC.ExactPrint
16081608
Development.IDE.GHC.Compat.ExactPrint
@@ -1661,7 +1661,7 @@ library hls-refactor-plugin
16611661

16621662
test-suite hls-refactor-plugin-tests
16631663
import: defaults, pedantic, test-defaults, warnings
1664-
if !flag(refactor) || (impl(ghc > 9.11) && !flag(ignore-plugins-ghc-bounds))
1664+
if !flag(refactor)
16651665
buildable: False
16661666
type: exitcode-stdio-1.0
16671667
hs-source-dirs: plugins/hls-refactor-plugin/test

plugins/hls-refactor-plugin/src/Development/IDE/GHC/ExactPrint.hs

Lines changed: 42 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,9 @@ import GHC.Parser.Annotation (AnnContext (..),
106106
deltaPos)
107107
import GHC.Types.SrcLoc (generatedSrcSpan)
108108
#endif
109+
#if MIN_VERSION_ghc(9,11,0)
110+
import GHC.Types.SrcLoc (UnhelpfulSpanReason(..))
111+
#endif
109112

110113
#if MIN_VERSION_ghc(9,9,0)
111114
import GHC (
@@ -116,6 +119,9 @@ import GHC (
116119
EpAnn (..),
117120
EpaLocation,
118121
EpaLocation' (..),
122+
#if MIN_VERSION_ghc(9,11,0)
123+
EpToken (..),
124+
#endif
119125
NameAdornment (..),
120126
NameAnn (..),
121127
SrcSpanAnnA,
@@ -124,7 +130,6 @@ import GHC (
124130
emptyComments,
125131
spanAsAnchor)
126132
#endif
127-
128133
setPrecedingLines ::
129134
#if !MIN_VERSION_ghc(9,9,0)
130135
Default t =>
@@ -168,6 +173,10 @@ annotateParsedSource (ParsedModule _ ps _) =
168173
(makeDeltaAst ps)
169174
#endif
170175

176+
#if MIN_VERSION_ghc(9,11,0)
177+
type Anchor = EpaLocation
178+
#endif
179+
171180
------------------------------------------------------------------------------
172181

173182
{- | A transformation for grafting source trees together. Use the semigroup
@@ -466,7 +475,10 @@ modifySmallestDeclWithM validSpan f a = do
466475
False -> first (DL.singleton ldecl <>) <$> modifyMatchingDecl rest
467476
modifyDeclsT' (fmap (first DL.toList) . modifyMatchingDecl) a
468477

469-
#if MIN_VERSION_ghc(9,9,0)
478+
#if MIN_VERSION_ghc(9,11,0)
479+
generatedAnchor :: DeltaPos -> Anchor
480+
generatedAnchor dp = EpaDelta (UnhelpfulSpan UnhelpfulNoLocationInfo) dp []
481+
#elif MIN_VERSION_ghc(9,9,0)
470482
generatedAnchor :: DeltaPos -> Anchor
471483
generatedAnchor dp = EpaDelta dp []
472484
#else
@@ -766,15 +778,28 @@ eqSrcSpan l r = leftmost_smallest l r == EQ
766778
addParensToCtxt :: Maybe EpaLocation -> AnnContext -> AnnContext
767779
addParensToCtxt close_dp = addOpen . addClose
768780
where
781+
#if MIN_VERSION_ghc(9,11,0)
782+
addOpen it@AnnContext{ac_open = []} = it{ac_open = [EpTok (epl 0)]}
783+
#else
769784
addOpen it@AnnContext{ac_open = []} = it{ac_open = [epl 0]}
785+
#endif
770786
addOpen other = other
771787
addClose it
788+
#if MIN_VERSION_ghc(9,11,0)
789+
| Just c <- close_dp = it{ac_close = [EpTok c]}
790+
| AnnContext{ac_close = []} <- it = it{ac_close = [EpTok (epl 0)]}
791+
#else
772792
| Just c <- close_dp = it{ac_close = [c]}
773793
| AnnContext{ac_close = []} <- it = it{ac_close = [epl 0]}
794+
#endif
774795
| otherwise = it
775796

776797
epl :: Int -> EpaLocation
798+
#if MIN_VERSION_ghc(9,11,0)
799+
epl n = EpaDelta (UnhelpfulSpan UnhelpfulNoLocationInfo) (SameLine n) []
800+
#else
777801
epl n = EpaDelta (SameLine n) []
802+
#endif
778803

779804
epAnn :: SrcSpan -> ann -> EpAnn ann
780805
epAnn srcSpan anns = EpAnn (spanAsAnchor srcSpan) anns emptyComments
@@ -803,14 +828,25 @@ removeComma (SrcSpanAnn (EpAnn anc (AnnListItem as) cs) l)
803828
#endif
804829

805830
addParens :: Bool -> GHC.NameAnn -> GHC.NameAnn
831+
#if MIN_VERSION_ghc(9,11,0)
806832
addParens True it@NameAnn{} =
807-
it{nann_adornment = NameParens, nann_open = epl 0, nann_close = epl 0 }
833+
it{nann_adornment = NameParens (EpTok (epl 0)) (EpTok (epl 0)) }
808834
addParens True it@NameAnnCommas{} =
809-
it{nann_adornment = NameParens, nann_open = epl 0, nann_close = epl 0 }
835+
it{nann_adornment = NameParens (EpTok (epl 0)) (EpTok (epl 0)) }
810836
addParens True it@NameAnnOnly{} =
811-
it{nann_adornment = NameParens, nann_open = epl 0, nann_close = epl 0 }
837+
it{nann_adornment = NameParens (EpTok (epl 0)) (EpTok (epl 0)) }
838+
addParens True it@NameAnnTrailing{} =
839+
NameAnn{nann_adornment = NameParens (EpTok (epl 0)) (EpTok (epl 0)), nann_name = epl 0, nann_trailing = nann_trailing it}
840+
#else
841+
addParens True it@NameAnn{} =
842+
it{nann_adornment = NameParens, nann_open=epl 0, nann_close=epl 0 }
843+
addParens True it@NameAnnCommas{} =
844+
it{nann_adornment = NameParens, nann_open=epl 0, nann_close=epl 0 }
845+
addParens True it@NameAnnOnly{} =
846+
it{nann_adornment = NameParens, nann_open=epl 0, nann_close=epl 0 }
812847
addParens True NameAnnTrailing{..} =
813-
NameAnn{nann_adornment = NameParens, nann_open = epl 0, nann_close = epl 0, nann_name = epl 0, ..}
848+
NameAnn{nann_adornment = NameParens, nann_open=epl 0, nann_close=epl 0, nann_name = epl 0, ..}
849+
#endif
814850
addParens _ it = it
815851

816852
removeTrailingComma :: GenLocated SrcSpanAnnA ast -> GenLocated SrcSpanAnnA ast

0 commit comments

Comments
 (0)