@@ -103,6 +103,11 @@ data SessionLoadingOptions = SessionLoadingOptions
103
103
, getCacheDirs :: String -> [String ] -> IO CacheDirs
104
104
-- | Return the GHC lib dir to use for the 'unsafeGlobalDynFlags'
105
105
, getInitialGhcLibDir :: IO (Maybe LibDir )
106
+ , fakeUid :: InstalledUnitId
107
+ -- ^ unit id used to tag the internal component built by ghcide
108
+ -- To reuse external interface files the unit ids must match,
109
+ -- thus make sure to build them with `--this-unit-id` set to the
110
+ -- same value as the ghcide fake uid
106
111
}
107
112
108
113
instance Default SessionLoadingOptions where
@@ -111,6 +116,7 @@ instance Default SessionLoadingOptions where
111
116
,loadCradle = HieBios. loadCradle
112
117
,getCacheDirs = getCacheDirsDefault
113
118
,getInitialGhcLibDir = getInitialGhcLibDirDefault
119
+ ,fakeUid = toInstalledUnitId (stringToUnitId " main" )
114
120
}
115
121
116
122
getInitialGhcLibDirDefault :: IO (Maybe LibDir )
@@ -225,7 +231,6 @@ loadSessionWithOptions SessionLoadingOptions{..} dir = do
225
231
, optCheckProject = getCheckProject
226
232
, optCustomDynFlags
227
233
, optExtensions
228
- , optFakeUid
229
234
} <- getIdeOptions
230
235
231
236
-- populate the knownTargetsVar with all the
@@ -278,7 +283,7 @@ loadSessionWithOptions SessionLoadingOptions{..} dir = do
278
283
new_deps' <- forM new_deps $ \ RawComponentInfo {.. } -> do
279
284
-- Remove all inplace dependencies from package flags for
280
285
-- components in this HscEnv
281
- let (df2, uids) = removeInplacePackages optFakeUid inplace rawComponentDynFlags
286
+ let (df2, uids) = removeInplacePackages fakeUid inplace rawComponentDynFlags
282
287
let prefix = show rawComponentUnitId
283
288
-- See Note [Avoiding bad interface files]
284
289
let hscComponents = sort $ map show uids
0 commit comments