@@ -148,6 +148,8 @@ import Ide.Plugin.Properties (HasProperty,
148
148
import Ide.PluginUtils (configForPlugin )
149
149
import Ide.Types (DynFlagsModifications (dynFlagsModifyGlobal , dynFlagsModifyParser ),
150
150
PluginId )
151
+ import System.FilePath ((<.>) )
152
+ import GHC (ms_mod_name )
151
153
152
154
-- | This is useful for rules to convert rules that can only produce errors or
153
155
-- a result into the more general IdeResult type that supports producing
@@ -348,7 +350,18 @@ getLocatedImportsRule =
348
350
Left diags -> pure (diags, Just (modName, Nothing ))
349
351
Right (FileImport path) -> pure ([] , Just (modName, Just path))
350
352
Right PackageImport -> pure ([] , Nothing )
351
- let moduleImports = catMaybes imports'
353
+
354
+ -- does this module have an hs-boot file? If so add a direct dependency
355
+ let bootPath = toNormalizedFilePath' $ fromNormalizedFilePath file <.> " hs-boot"
356
+ boot <- use GetFileExists bootPath
357
+ bootArtifact <- if boot == Just True
358
+ then do
359
+ let modName = ms_mod_name ms
360
+ loc <- liftIO $ mkHomeModLocation dflags modName (fromNormalizedFilePath bootPath)
361
+ return $ Just (noLoc modName, Just (ArtifactsLocation bootPath (Just loc) True ))
362
+ else pure Nothing
363
+
364
+ let moduleImports = catMaybes $ bootArtifact : imports'
352
365
pure (concat diags, Just moduleImports)
353
366
354
367
type RawDepM a = StateT (RawDependencyInformation , IntMap ArtifactsLocation ) Action a
@@ -374,7 +387,7 @@ rawDependencyInformation fs = do
374
387
375
388
go :: NormalizedFilePath -- ^ Current module being processed
376
389
-> Maybe ModSummary -- ^ ModSummary of the module
377
- -> StateT ( RawDependencyInformation , IntMap ArtifactsLocation ) Action FilePathId
390
+ -> RawDepM FilePathId
378
391
go f msum = do
379
392
-- First check to see if we have already processed the FilePath
380
393
-- If we have, just return its Id but don't update any of the state.
0 commit comments