Skip to content

Commit 1d324d6

Browse files
enable stylish-haskell for ghc-9.10
1 parent 02c10ba commit 1d324d6

File tree

4 files changed

+12
-7
lines changed

4 files changed

+12
-7
lines changed

.github/workflows/test.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,8 @@ jobs:
164164
name: Test hls-stan-plugin
165165
run: cabal test hls-stan-plugin-tests || cabal test hls-stan-plugin-tests
166166

167-
# TODO enable when it supports 9.10
168-
- if: matrix.test && matrix.ghc != '9.10' && matrix.ghc != '9.12'
167+
# TODO enable when it supports 9.12
168+
- if: matrix.test && matrix.ghc != '9.12'
169169
name: Test hls-stylish-haskell-plugin
170170
run: cabal test hls-stylish-haskell-plugin-tests || cabal test hls-stylish-haskell-plugin-tests
171171

cabal.project

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ packages:
88
./hls-test-utils
99

1010

11-
index-state: 2025-04-08T01:30:37Z
11+
index-state: 2025-04-19T07:34:07Z
1212

1313
tests: True
1414
test-show-details: direct

haskell-language-server.cabal

+4-4
Original file line numberDiff line numberDiff line change
@@ -1551,14 +1551,14 @@ flag stylishHaskell
15511551
manual: True
15521552

15531553
common stylishHaskell
1554-
if flag(stylishHaskell) && (impl(ghc < 9.10) || flag(ignore-plugins-ghc-bounds))
1554+
if flag(stylishHaskell) && (impl(ghc < 9.11) || flag(ignore-plugins-ghc-bounds))
15551555
build-depends: haskell-language-server:hls-stylish-haskell-plugin
15561556
cpp-options: -Dhls_stylishHaskell
15571557

15581558
library hls-stylish-haskell-plugin
15591559
import: defaults, pedantic, warnings
15601560
-- https://github.com/haskell/stylish-haskell/issues/479
1561-
if !(flag(stylishHaskell) && (impl(ghc < 9.10) || flag(ignore-plugins-ghc-bounds)))
1561+
if !flag(stylishHaskell) || (impl(ghc > 9.11) && !flag(ignore-plugins-ghc-bounds))
15621562
buildable: False
15631563
exposed-modules: Ide.Plugin.StylishHaskell
15641564
hs-source-dirs: plugins/hls-stylish-haskell-plugin/src
@@ -1570,13 +1570,13 @@ library hls-stylish-haskell-plugin
15701570
, hls-plugin-api == 2.10.0.0
15711571
, lsp-types
15721572
, mtl
1573-
, stylish-haskell ^>=0.12 || ^>=0.13 || ^>=0.14
1573+
, stylish-haskell >=0.12 && <0.16
15741574
, text
15751575

15761576

15771577
test-suite hls-stylish-haskell-plugin-tests
15781578
import: defaults, pedantic, test-defaults, warnings
1579-
if !(flag(stylishHaskell) && (impl(ghc < 9.10) || flag(ignore-plugins-ghc-bounds)))
1579+
if !flag(stylishHaskell) || (impl(ghc > 9.11) && !flag(ignore-plugins-ghc-bounds))
15801580
buildable: False
15811581
type: exitcode-stdio-1.0
15821582
hs-source-dirs: plugins/hls-stylish-haskell-plugin/test

plugins/hls-stylish-haskell-plugin/src/Ide/Plugin/StylishHaskell.hs

+5
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,15 @@ provider recorder ide _token typ contents fp _opts = do
7979
-- If no such file has been found, return default config.
8080
loadConfigFrom :: FilePath -> IO Config
8181
loadConfigFrom file = do
82+
#if MIN_VERSION_stylish_haskell(0,15,0)
83+
let configSearchStrategy = SearchFromDirectory (takeDirectory file)
84+
config <- loadConfig (makeVerbose False) configSearchStrategy
85+
#else
8286
currDir <- getCurrentDirectory
8387
setCurrentDirectory (takeDirectory file)
8488
config <- loadConfig (makeVerbose False) Nothing
8589
setCurrentDirectory currDir
90+
#endif
8691
pure config
8792

8893
-- | Run stylish-haskell on the given text with the given configuration.

0 commit comments

Comments
 (0)