@@ -17,10 +17,10 @@ import Data.ByteString.Base16 (encode)
17
17
import qualified Data.ByteString.Char8 as B
18
18
import Data.Functor ((<&>) )
19
19
import Data.Maybe (fromMaybe )
20
- import Data.Text (Text )
20
+ import Data.Text (pack , Text )
21
21
import Development.IDE.Core.Rules (defineNoFile )
22
22
import Development.IDE.Core.Service (getIdeOptions )
23
- import Development.IDE.Core.Shake (sendEvent , define , useNoFile_ )
23
+ import Development.IDE.Core.Shake (actionLogger , sendEvent , define , useNoFile_ )
24
24
import Development.IDE.GHC.Util
25
25
import Development.IDE.Types.Location (fromNormalizedFilePath )
26
26
import Development.IDE.Types.Options (IdeOptions (IdeOptions , optTesting ))
@@ -42,6 +42,7 @@ import System.FilePath.Posix (addTrailingPathSeparator,
42
42
import Language.Haskell.LSP.Messages as LSP
43
43
import Language.Haskell.LSP.Types as LSP
44
44
import Data.Aeson (ToJSON (toJSON ))
45
+ import Development.IDE.Types.Logger (logDebug )
45
46
46
47
-- Prefix for the cache path
47
48
cacheDir :: String
@@ -63,18 +64,23 @@ loadGhcSession =
63
64
64
65
cradleToSession :: Rules ()
65
66
cradleToSession = define $ \ LoadCradle nfp -> do
67
+
66
68
let f = fromNormalizedFilePath nfp
67
69
68
70
IdeOptions {optTesting} <- getIdeOptions
69
71
72
+ logger <- actionLogger
73
+ liftIO $ logDebug logger $ " Running cradle " <> pack (fromNormalizedFilePath nfp)
74
+
70
75
-- If the path points to a directory, load the implicit cradle
71
76
mbYaml <- doesDirectoryExist f <&> \ isDir -> if isDir then Nothing else Just f
72
- cradle <- liftIO $ maybe (loadImplicitCradle $ addTrailingPathSeparator f) loadCradle mbYaml
77
+ cradle <- liftIO $ maybe (loadImplicitCradle $ addTrailingPathSeparator f) loadCradle mbYaml
73
78
74
79
when optTesting $
75
80
sendEvent $ notifyCradleLoaded f
76
81
77
- cmpOpts <- liftIO $ getComponentOptions cradle
82
+ -- Avoid interrupting `getComponentOptions` since it calls external processes
83
+ cmpOpts <- liftIO $ mask $ \ _ -> getComponentOptions cradle
78
84
let opts = componentOptions cmpOpts
79
85
deps = componentDependencies cmpOpts
80
86
deps' = case mbYaml of
0 commit comments