Skip to content

Commit ea1b41d

Browse files
Print info message when ignoring a file due to a none cradle (#2701)
Co-authored-by: Michael Peyton Jones <[email protected]>
1 parent a96b623 commit ea1b41d

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

ghcide/session-loader/Development/IDE/Session.hs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -606,6 +606,8 @@ loadSessionWithOptions SessionLoadingOptions{..} dir = do
606606
cradleToOptsAndLibDir :: Show a => Logger -> Cradle a -> FilePath
607607
-> IO (Either [CradleError] (ComponentOptions, FilePath))
608608
cradleToOptsAndLibDir logger cradle file = do
609+
let noneCradleFoundMessage :: FilePath -> T.Text
610+
noneCradleFoundMessage f = T.pack $ "none cradle found for " <> f <> ", ignoring the file"
609611
-- Start off by getting the session options
610612
logDebug logger $ T.pack $ "Output from setting up the cradle " <> show cradle
611613
cradleRes <- HieBios.getCompilerOptions file cradle
@@ -617,13 +619,14 @@ cradleToOptsAndLibDir logger cradle file = do
617619
-- This is the successful path
618620
CradleSuccess libDir -> pure (Right (r, libDir))
619621
CradleFail err -> return (Left [err])
620-
-- For the None cradle perhaps we still want to report an Info
621-
-- message about the fact that the file is being ignored.
622-
CradleNone -> return (Left [])
622+
CradleNone -> do
623+
logInfo logger $ noneCradleFoundMessage file
624+
return (Left [])
623625

624626
CradleFail err -> return (Left [err])
625-
-- Same here
626-
CradleNone -> return (Left [])
627+
CradleNone -> do
628+
logInfo logger $ noneCradleFoundMessage file
629+
return (Left [])
627630

628631
emptyHscEnv :: IORef NameCache -> FilePath -> IO HscEnv
629632
emptyHscEnv nc libDir = do

0 commit comments

Comments
 (0)