wrapper: cd to --cwd earlier

Currently, if `haskell-language-server-wrapper` is called with `--cwd`, a cradle will first be loaded and _then_ the change of working directory will happen. This commit reorders this such that if `--cwd` is supplied, the very first action is to change directory. This means a cradle will be found with `--cwd`, rather than the directory that `haskell-language-server-wrapper` was called in.
This commit is contained in:
Ollie Charles 2020-10-01 13:57:13 +01:00 committed by fendor
parent 6d9b12ee7d
commit 248e8dfac8

View File

@ -47,6 +47,8 @@ main = do
launchHaskellLanguageServer :: LspArguments -> IO ()
launchHaskellLanguageServer LspArguments{..} = do
whenJust argsCwd setCurrentDirectory
d <- getCurrentDirectory
-- Get the cabal directory from the cradle
@ -55,8 +57,6 @@ launchHaskellLanguageServer LspArguments{..} = do
when argsProjectGhcVersion $ getRuntimeGhcVersion' cradle >>= putStrLn >> exitSuccess
whenJust argsCwd setCurrentDirectory
progName <- getProgName
hPutStrLn stderr $ "Run entered for haskell-language-server-wrapper(" ++ progName ++ ") "
++ hlsVersion