1module Test.Hls.Command 2 ( hlsCommand, 3 hlsCommandExamplePlugin, 4 hlsCommandVomit, 5 logFilePath, 6 ) 7where 8 9import Data.Maybe (fromMaybe) 10import System.Environment (lookupEnv) 11import System.IO.Unsafe (unsafePerformIO) 12import Test.Hls 13 14logFilePath :: String 15logFilePath = "hls-" ++ show ghcVersion ++ ".log" 16 17-- | The command to execute the version of hls for the current compiler. 18-- 19-- Both @stack test@ and @cabal new-test@ setup the environment so @hls@ is 20-- on PATH. Cabal seems to respond to @build-tool-depends@ specifically while 21-- stack just puts all project executables on PATH. 22hlsCommand :: String 23{-# NOINLINE hlsCommand #-} 24hlsCommand = unsafePerformIO $ do 25 testExe <- fromMaybe "haskell-language-server" <$> lookupEnv "HLS_TEST_EXE" 26 pure $ testExe ++ " --lsp -d -j4 -l test-logs/" ++ logFilePath 27 28hlsCommandVomit :: String 29hlsCommandVomit = hlsCommand ++ " --vomit" 30 31hlsCommandExamplePlugin :: String 32hlsCommandExamplePlugin = hlsCommand ++ " --example" 33