Skip to content

Commit

Permalink
Use functionality from upstream PR
Browse files Browse the repository at this point in the history
  • Loading branch information
jhrcek committed Jun 27, 2024
1 parent 907c5ed commit c4f6c13
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
5 changes: 5 additions & 0 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ constraints:
-- in the future, thus: TODO: remove this flag.
bitvec -simd,

source-repository-package
type: git
location: https://github.com/jhrcek/stylish-haskell.git
tag: afefca07e7d1c6b10b1d71006192afcf49c4783b

if impl(ghc >= 9.9)
-- https://github.com/haskell/haskell-language-server/issues/4324
benchmarks: False
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import Ide.PluginUtils
import Ide.Types hiding (Config)
import Language.Haskell.Stylish
import Language.LSP.Protocol.Types as LSP
import System.Directory
import System.FilePath

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

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

0 comments on commit c4f6c13

Please sign in to comment.