Skip to content

Commit abc4123

Browse files
committed
move config setting to session loading options
(where it really belongs)
1 parent affaa5d commit abc4123

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,11 @@ data SessionLoadingOptions = SessionLoadingOptions
103103
, getCacheDirs :: String -> [String] -> IO CacheDirs
104104
-- | Return the GHC lib dir to use for the 'unsafeGlobalDynFlags'
105105
, 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
106111
}
107112

108113
instance Default SessionLoadingOptions where
@@ -111,6 +116,7 @@ instance Default SessionLoadingOptions where
111116
,loadCradle = HieBios.loadCradle
112117
,getCacheDirs = getCacheDirsDefault
113118
,getInitialGhcLibDir = getInitialGhcLibDirDefault
119+
,fakeUid = toInstalledUnitId (stringToUnitId "main")
114120
}
115121

116122
getInitialGhcLibDirDefault :: IO (Maybe LibDir)
@@ -225,7 +231,6 @@ loadSessionWithOptions SessionLoadingOptions{..} dir = do
225231
, optCheckProject = getCheckProject
226232
, optCustomDynFlags
227233
, optExtensions
228-
, optFakeUid
229234
} <- getIdeOptions
230235

231236
-- populate the knownTargetsVar with all the
@@ -278,7 +283,7 @@ loadSessionWithOptions SessionLoadingOptions{..} dir = do
278283
new_deps' <- forM new_deps $ \RawComponentInfo{..} -> do
279284
-- Remove all inplace dependencies from package flags for
280285
-- components in this HscEnv
281-
let (df2, uids) = removeInplacePackages optFakeUid inplace rawComponentDynFlags
286+
let (df2, uids) = removeInplacePackages fakeUid inplace rawComponentDynFlags
282287
let prefix = show rawComponentUnitId
283288
-- See Note [Avoiding bad interface files]
284289
let hscComponents = sort $ map show uids

ghcide/src/Development/IDE/Types/Options.hs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,6 @@ data IdeOptions = IdeOptions
8585
-- ^ Will be called right after setting up a new cradle,
8686
-- allowing to customize the Ghc options used
8787
, optShakeOptions :: ShakeOptions
88-
, optFakeUid :: InstalledUnitId
89-
-- ^ unit id used to tag the internal component built by ghcide
90-
-- To reuse external interface files the unit ids must match,
91-
-- thus make sure to build them with `--this-unit-id` set to the
92-
-- same value as the ghcide fake uid
9388
}
9489

9590
optShakeFiles :: IdeOptions -> Maybe FilePath
@@ -142,7 +137,6 @@ defaultIdeOptions session = IdeOptions
142137
,optCheckParents = pure CheckOnSaveAndClose
143138
,optHaddockParse = HaddockParse
144139
,optCustomDynFlags = id
145-
,optFakeUid = toInstalledUnitId (stringToUnitId "main")
146140
}
147141

148142

0 commit comments

Comments
 (0)