@@ -157,7 +157,9 @@ run scheduler _origDir plugins captureFp = flip E.catches handlers $ do
157157
158158 -- Check for mismatching GHC versions
159159 -- Ignore hie.yaml parse errors. They get reported in ModuleCache.hs
160- let parseErrorHandler (_ :: Yaml. ParseException ) = return Nothing
160+ let parseErrorHandler (_ :: Yaml. ParseException ) = do
161+ logm " Caught a yaml parse exception"
162+ return Nothing
161163 dummyCradleFile = fromMaybe currentDir lspRootDir </> " File.hs"
162164 logm $ " Dummy Cradle File: " ++ dummyCradleFile
163165 mcradle <- liftIO $ E. catch (Just <$> findLocalCradle dummyCradleFile) parseErrorHandler
@@ -411,13 +413,12 @@ reactor inp diagIn = do
411413 currentDir <- liftIO getCurrentDirectory
412414
413415 -- Check for mismatching GHC versions
414- -- Ignore hie.yaml parse errors. They get reported in ModuleCache.hs
415- let parseErrorHandler (_ :: Yaml. ParseException ) = return Nothing
416- dummyCradleFile = (fromMaybe currentDir lspRootDir) </> " File.hs"
417- cradleRes <- liftIO $ E. catch (Just <$> findLocalCradle dummyCradleFile) parseErrorHandler
416+ let dummyCradleFile = (fromMaybe currentDir lspRootDir) </> " File.hs"
417+ logm $ " Dummy Cradle file result: " ++ dummyCradleFile
418+ cradleRes <- liftIO $ E. try (findLocalCradle dummyCradleFile)
418419
419420 case cradleRes of
420- Just cradle -> do
421+ Right cradle -> do
421422 projGhcVersion <- liftIO $ getProjectGhcVersion cradle
422423 when (projGhcVersion /= hieGhcVersion) $ do
423424 let msg = T. pack $ " Mismatching GHC versions: " ++ cradleDisplay cradle ++
@@ -434,7 +435,9 @@ reactor inp diagIn = do
434435 reactorSend $ NotShowMessage $ fmServerShowMessageNotification J. MtWarning cabalMsg
435436 reactorSend $ NotLogMessage $ fmServerLogMessageNotification J. MtWarning cabalMsg
436437
437- Nothing -> return ()
438+ Left (_ :: Yaml. ParseException ) -> do
439+ logm " Failed to parse it"
440+ reactorSend $ NotShowMessage $ fmServerShowMessageNotification J. MtError " Couldn't parse hie.yaml"
438441
439442 renv <- ask
440443 let hreq = GReq tn " init-hoogle" Nothing Nothing Nothing callback Nothing $ IdeResultOk <$> Hoogle. initializeHoogleDb
0 commit comments