on master help sign in
Minor IDE cleanups (#945)
b9dfd49Neil Mitchell
src/Development/IDE/Functions/Documentation.hs+2−1
@@ -13,9 +13,10 @@ import Data.Maybe
13import qualified Data.Text as T
13import qualified Data.Text as T
14import Development.IDE.Functions.GHCError
14import Development.IDE.Functions.GHCError
15import Development.IDE.Functions.SpanInfo
15import Development.IDE.Functions.SpanInfo
16−import Development.IDE.UtilGHC
17import FastString
16import FastString
18import GHC
17import GHC
18+import SrcLoc
19+
19
20
20getDocumentation
21getDocumentation
21 :: Name -- ^ The name you want documentation for.
22 :: Name -- ^ The name you want documentation for.
src/Development/IDE/UtilGHC.hs+20−3
@@ -24,7 +24,9 @@ module Development.IDE.UtilGHC(
24 importGenerated,
24 importGenerated,
25 mkImport,
25 mkImport,
26 runGhcFast,
26 runGhcFast,
27− Development.IDE.UtilGHC.RealLocated,
27+ setImports,
28+ setPackageState,
29+ setThisInstalledUnitId,
28 modIsInternal
30 modIsInternal
29 ) where
31 ) where
30
32
@@ -168,6 +170,23 @@ fakeLlvmConfig :: (LlvmTargets, LlvmPasses)
168fakeLlvmConfig = ([], [])
170fakeLlvmConfig = ([], [])
169
171
170
172
173+setThisInstalledUnitId :: UnitId -> DynFlags -> DynFlags
174+setThisInstalledUnitId unitId dflags =
175+ dflags {thisInstalledUnitId = toInstalledUnitId unitId}
176+
177+setImports :: [FilePath] -> DynFlags -> DynFlags
178+setImports paths dflags = dflags { importPaths = paths }
179+
180+setPackageState :: PackageState -> DynFlags -> DynFlags
181+setPackageState state dflags =
182+ dflags
183+ { pkgDatabase = pkgStateDb state
184+ , pkgState = pkgStateState state
185+ , thisUnitIdInsts_ = pkgThisUnitIdInsts state
186+ }
187+
188+
189+
171-- Orphan instances for types from the GHC API.
190-- Orphan instances for types from the GHC API.
172instance Show CoreModule where show = prettyPrint
191instance Show CoreModule where show = prettyPrint
173instance NFData CoreModule where rnf !_ = ()
192instance NFData CoreModule where rnf !_ = ()
@@ -194,5 +213,3 @@ instance Show (GenLocated SrcSpan ModuleName) where show = prettyPrint
194instance Show PackageName where show = prettyPrint
213instance Show PackageName where show = prettyPrint
195instance Show Packages.PackageState where show _ = "PackageState"
214instance Show Packages.PackageState where show _ = "PackageState"
196instance Show Name where show = prettyPrint
215instance Show Name where show = prettyPrint
197−
198−type RealLocated = GenLocated RealSrcSpan