File tree 1 file changed +15
-1
lines changed
ghcide/src/Development/IDE/Import
1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ import Data.Maybe
29
29
import System.FilePath
30
30
#if MIN_VERSION_ghc(9,3,0)
31
31
import GHC.Types.PkgQual
32
+ import GHC.Unit.State
32
33
#endif
33
34
34
35
data Import
@@ -147,13 +148,26 @@ locateModule env comp_info exts targetFor modName mbPkgName isSource = do
147
148
map snd import_paths
148
149
#endif
149
150
150
- mbFile <- locateModuleFile ((homeUnitId_ dflags, importPaths dflags) : import_paths' ) exts targetFor isSource $ unLoc modName
151
+ mbFile <- locateModuleFile ((homeUnitId_ dflags, importPaths dflags) : other_imports ) exts targetFor isSource $ unLoc modName
151
152
case mbFile of
152
153
Nothing -> lookupInPackageDB env
153
154
Just (uid, file) -> toModLocation uid file
154
155
where
155
156
dflags = hsc_dflags env
156
157
import_paths = mapMaybe (mkImportDirs env) comp_info
158
+ other_imports =
159
+ #if MIN_VERSION_ghc(9,4,0)
160
+ -- On 9.4+ instead of bringing all the units into scope, only bring into scope the units
161
+ -- this one depends on
162
+ map (\ uid -> (uid, importPaths (homeUnitEnv_dflags (ue_findHomeUnitEnv uid ue)))) hpt_deps
163
+ ue = hsc_unit_env env
164
+ units = homeUnitEnv_units $ ue_findHomeUnitEnv (homeUnitId_ dflags) ue
165
+ hpt_deps :: [UnitId ]
166
+ hpt_deps = homeUnitDepends units
167
+ #else
168
+ import_paths'
169
+ #endif
170
+
157
171
toModLocation uid file = liftIO $ do
158
172
loc <- mkHomeModLocation dflags (unLoc modName) (fromNormalizedFilePath file)
159
173
#if MIN_VERSION_ghc(9,0,0)
You can’t perform that action at this time.
0 commit comments