Skip to content

Commit 875a1ce

Browse files
committed
Fix Check commands handling of projectRoot.
1 parent 89ed1a6 commit 875a1ce

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

ghcide/exe/Main.hs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,8 @@ main = withTelemetryLogger $ \telemetryLogger -> do
5050
if argsVersion then ghcideVersion >>= putStrLn >> exitSuccess
5151
else hPutStrLn stderr {- see WARNING above -} =<< ghcideVersion
5252

53-
-- getHieDbLoc takes a directory path (the project root) and hashes it to find the location of the hiedb
54-
-- when running commands directly from GHCIDE we need to provide the ABSOLUTE path to the project root (that's what HLS uses)
55-
argsCwd <-case argsCwd of
53+
-- if user uses --cwd option we need to make this path absolute (and set the current directory to it)
54+
argsCwd <- case argsCwd of
5655
Nothing -> IO.getCurrentDirectory
5756
Just root -> IO.setCurrentDirectory root >> IO.getCurrentDirectory
5857

ghcide/src/Development/IDE/Main.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ defaultMain Arguments{..} = flip withHeapStats fun =<< argsLogger
319319
hieChan
320320
dumpSTMStats
321321
Check argFiles -> do
322-
dir <- IO.getCurrentDirectory
322+
dir <- maybe IO.getCurrentDirectory return argsProjectRoot
323323
dbLoc <- getHieDbLoc dir
324324
runWithDb logger dbLoc $ \hiedb hieChan -> do
325325
-- GHC produces messages with UTF8 in them, so make sure the terminal doesn't error

0 commit comments

Comments
 (0)