Skip to content

Commit

Permalink
Fix Check commands handling of projectRoot.
Browse files Browse the repository at this point in the history
  • Loading branch information
drsooch committed Dec 29, 2021
1 parent 89ed1a6 commit 875a1ce
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 2 additions & 3 deletions ghcide/exe/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,8 @@ main = withTelemetryLogger $ \telemetryLogger -> do
if argsVersion then ghcideVersion >>= putStrLn >> exitSuccess
else hPutStrLn stderr {- see WARNING above -} =<< ghcideVersion

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

Expand Down
2 changes: 1 addition & 1 deletion ghcide/src/Development/IDE/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ defaultMain Arguments{..} = flip withHeapStats fun =<< argsLogger
hieChan
dumpSTMStats
Check argFiles -> do
dir <- IO.getCurrentDirectory
dir <- maybe IO.getCurrentDirectory return argsProjectRoot
dbLoc <- getHieDbLoc dir
runWithDb logger dbLoc $ \hiedb hieChan -> do
-- GHC produces messages with UTF8 in them, so make sure the terminal doesn't error
Expand Down

0 comments on commit 875a1ce

Please sign in to comment.