Skip to content

Commit 248e8df

Browse files
ocharlesfendor
authored andcommitted
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.
1 parent 6d9b12e commit 248e8df

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

exe/Wrapper.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ main = do
4747

4848
launchHaskellLanguageServer :: LspArguments -> IO ()
4949
launchHaskellLanguageServer LspArguments{..} = do
50+
whenJust argsCwd setCurrentDirectory
51+
5052
d <- getCurrentDirectory
5153

5254
-- Get the cabal directory from the cradle
@@ -55,8 +57,6 @@ launchHaskellLanguageServer LspArguments{..} = do
5557

5658
when argsProjectGhcVersion $ getRuntimeGhcVersion' cradle >>= putStrLn >> exitSuccess
5759

58-
whenJust argsCwd setCurrentDirectory
59-
6060
progName <- getProgName
6161
hPutStrLn stderr $ "Run entered for haskell-language-server-wrapper(" ++ progName ++ ") "
6262
++ hlsVersion

0 commit comments

Comments
 (0)