stylish-haskell
stylish-haskell copied to clipboard
Make it possible to search for config without getCurrentDirectory
Reopening https://github.com/haskell/stylish-haskell/pull/482 whose branch I deleted by mistake.
Original description: An attempt to resolve https://github.com/haskell/stylish-haskell/issues/478
The intention is to make it possible to avoid dependency on getCurrentDirectory (which is problematic in haskell-language-server where multiple things running concurrently might depend on current directory and having to setCurrentDirectory just for stylish-haskell to be able to find the right config might lead to various race conditions).
The way to achieve it is to introduce new datatype ConfigSearchStrategy whose constructor SearchFromDirectory startDir makes it possible to supply a directory explicitly.
See this HLS PR for an example of how this new functionality would be used: https://github.com/haskell/haskell-language-server/pull/4338