Skip to content

Commit c4f6c13

Browse files
committed
Use functionality from upstream PR
1 parent 907c5ed commit c4f6c13

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

cabal.project

+5
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,11 @@ constraints:
4242
-- in the future, thus: TODO: remove this flag.
4343
bitvec -simd,
4444

45+
source-repository-package
46+
type: git
47+
location: https://github.com/jhrcek/stylish-haskell.git
48+
tag: afefca07e7d1c6b10b1d71006192afcf49c4783b
49+
4550
if impl(ghc >= 9.9)
4651
-- https://github.com/haskell/haskell-language-server/issues/4324
4752
benchmarks: False

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

+3-7
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ import Ide.PluginUtils
2525
import Ide.Types hiding (Config)
2626
import Language.Haskell.Stylish
2727
import Language.LSP.Protocol.Types as LSP
28-
import System.Directory
2928
import System.FilePath
3029

3130
data Log
@@ -78,12 +77,9 @@ provider recorder ide _token typ contents fp _opts = do
7877
-- | Recursively search in every directory of the given filepath for .stylish-haskell.yaml.
7978
-- If no such file has been found, return default config.
8079
loadConfigFrom :: FilePath -> IO Config
81-
loadConfigFrom file = do
82-
currDir <- getCurrentDirectory
83-
setCurrentDirectory (takeDirectory file)
84-
config <- loadConfig (makeVerbose False) Nothing
85-
setCurrentDirectory currDir
86-
pure config
80+
loadConfigFrom file =
81+
let configSearchStrategy = SearchFromDirectory (takeDirectory file)
82+
in loadConfig (makeVerbose False) configSearchStrategy
8783

8884
-- | Run stylish-haskell on the given text with the given configuration.
8985
runStylishHaskell :: FilePath -- ^ Location of the file being formatted. Used for error message

0 commit comments

Comments
 (0)