Skip to content

Commit 1df58ae

Browse files
committed
Log only on loadHieFile failure
1 parent cbb9999 commit 1df58ae

File tree

1 file changed

+4
-17
lines changed

1 file changed

+4
-17
lines changed

ghcide/src/Development/IDE/Types/HscEnvEq.hs

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ module Development.IDE.Types.HscEnvEq
1515
import Control.Concurrent.Async (Async, async, waitCatch)
1616
import Control.Concurrent.Strict (modifyVar, newVar)
1717
import Control.DeepSeq (force)
18-
import Control.Exception (SomeException, evaluate, mask, throwIO)
18+
import Control.Exception (evaluate, mask, throwIO)
1919
import Control.Exception.Safe (tryAny)
2020
import Control.Monad.Extra (eitherM, join, mapMaybeM, void)
2121
import Data.Either (fromRight)
@@ -126,11 +126,6 @@ newHscEnvEqWithImportPaths envImportPaths se hscEnv deps = do
126126
indexDependencyHieFiles :: IO ()
127127
indexDependencyHieFiles = void
128128
$ Map.traverseWithKey indexPackageHieFiles packagesWithModules
129-
logPackage :: UnitInfo -> IO ()
130-
logPackage package = Logger.logDebug (logger se) $ "!!!!!!!!!!!! hscEnvEq :\n"
131-
<> T.pack (concatMap show $ unitLibraryDirs package) <> "\n"
132-
<> T.pack (show $ unitId package)
133-
<> "\n!!!!!!!!!!!!!!!!!!!!!!"
134129
indexPackageHieFiles :: Package -> [Module] -> IO ()
135130
indexPackageHieFiles (Package package) modules = do
136131
let pkgLibDir :: FilePath
@@ -139,25 +134,17 @@ newHscEnvEqWithImportPaths envImportPaths se hscEnv deps = do
139134
(libraryDir : _) -> libraryDir
140135
hieDir :: FilePath
141136
hieDir = pkgLibDir </> "extra-compilation-artifacts"
142-
logPackage package
143137
modIfaces <- mapMaybeM loadModIFace modules
144138
traverse_ (indexModuleHieFile hieDir) modIfaces
145-
logModule :: FilePath -> Either SomeException HieFile -> IO ()
146-
logModule hiePath hieResults = Logger.logDebug (logger se) $ "!!!!!!!!!!!! hscEnvEq :\n"
147-
<> T.pack hiePath
148-
<> (case hieResults of
149-
Left e -> "\n" <> T.pack (show e)
150-
Right _ -> ""
151-
)
152-
<> "\n!!!!!!!!!!!!!!!!!!!!!!"
153139
indexModuleHieFile :: FilePath -> ModIface -> IO ()
154140
indexModuleHieFile hieDir modIface = do
155141
let hiePath :: FilePath
156142
hiePath = hieDir </> toFilePath (moduleName $ mi_module modIface) ++ ".hie"
157143
hieResults <- tryAny $ loadHieFile (mkUpdater $ ideNc se) hiePath
158-
logModule hiePath hieResults
159144
case hieResults of
160-
Left _ -> return ()
145+
Left e -> Logger.logDebug (logger se) $
146+
"Failed to index dependency HIE file:\n"
147+
<> T.pack (show e)
161148
Right hie ->
162149
indexHieFile se (toNormalizedFilePath' hiePath) (FakeFile Nothing) (mi_src_hash modIface) hie
163150
toFilePath :: ModuleName -> FilePath

0 commit comments

Comments
 (0)