Compatibility with fbghc (#892)

* Compatibility with fbghc

Rather than forking ghcide, we use conditional compilation to build with https://github.com/facebook/fbghc hopefully only until certain changes have been upstreamed.

* Reexport DynFlags from Compat.GHC

* Add a link to the fbghc repo
This commit is contained in:
Pepe Iborra 2020-11-07 15:13:40 +00:00 committed by GitHub
parent 00614465fa
commit f4bfe9c103
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 24 additions and 22 deletions

View File

@ -59,7 +59,6 @@ import System.Info
import System.IO
import GHCi
import DynFlags
import HscTypes (ic_dflags, hsc_IC, hsc_dflags, hsc_NC)
import Linker
import Module

View File

@ -15,7 +15,6 @@ import Data.List.Extra
import System.FilePath
import System.IO.Extra
import Data.Char
import DynFlags
import qualified HeaderInfo as Hdr
import Development.IDE.Types.Diagnostics
import Development.IDE.Types.Location

View File

@ -69,7 +69,6 @@ import Language.Haskell.LSP.Types (DocumentHighlight (..))
import qualified GHC.LanguageExtensions as LangExt
import HscTypes hiding (TargetModule, TargetFile)
import DynFlags (gopt_set, xopt)
import GHC.Generics(Generic)
import qualified Development.IDE.Spans.AtPoint as AtPoint

View File

@ -26,7 +26,6 @@ import Development.IDE.GHC.Compat
import Packages
import SysTools
import Module
import DynFlags
import Panic
import FileCleanup
#if MIN_GHC_API_VERSION(8,8,2)

View File

@ -28,8 +28,6 @@ module Development.IDE.GHC.Compat(
addBootSuffixLocnOut,
#endif
hPutStringBuffer,
includePathsGlobal,
includePathsQuote,
addIncludePathsQuote,
getModuleHash,
getPackageName,
@ -37,6 +35,7 @@ module Development.IDE.GHC.Compat(
GHC.ModLocation,
Module.addBootSuffix,
pattern ModLocation,
pattern ExposePackage,
HasSrcSpan,
getLoc,
upNameCache,
@ -54,6 +53,7 @@ module Development.IDE.GHC.Compat(
#endif
module GHC,
module DynFlags,
initializePlugins,
applyPluginsParsedResultAction,
module Compat.HieTypes,
@ -66,7 +66,8 @@ import LinkerTypes
#endif
import StringBuffer
import DynFlags
import qualified DynFlags
import DynFlags hiding (ExposePackage)
import Fingerprint (Fingerprint)
import qualified Module
import Packages
@ -274,3 +275,11 @@ applyPluginsParsedResultAction env dflags ms hpm_annotations parsed = do
fmap hpm_module $
runHsc env $ withPlugins dflags applyPluginAction
(HsParsedModule parsed [] hpm_annotations)
pattern ExposePackage :: String -> PackageArg -> ModRenaming -> PackageFlag
-- https://github.com/facebook/fbghc
#ifdef __FACEBOOK_HASKELL__
pattern ExposePackage s a mr <- DynFlags.ExposePackage s a _ mr
#else
pattern ExposePackage s a mr = DynFlags.ExposePackage s a mr
#endif

View File

@ -68,7 +68,6 @@ import Outputable (showSDocUnsafe, ppr, showSDoc, Outputable)
import Packages (getPackageConfigMap, lookupPackage')
import SrcLoc (mkRealSrcLoc)
import FastString (mkFastString)
import DynFlags (emptyFilesToClean, unsafeGlobalDynFlags)
import Module (moduleNameSlashes, InstalledUnitId)
import OccName (parenSymOcc)
import RdrName (nameRdrName, rdrNameOcc)

View File

@ -54,7 +54,6 @@ import HscTypes
import Parser
import Text.Regex.TDFA (mrAfter, (=~), (=~~))
import Outputable (ppr, showSDocUnsafe)
import DynFlags (xFlags, FlagSpec(..))
import GHC.LanguageExtensions.Type (Extension)
import Data.Function
import Control.Arrow ((>>>))

View File

@ -23,7 +23,6 @@ import Name
import RdrName
import Type
import Packages
import DynFlags
#if MIN_GHC_API_VERSION(8,10,0)
import Predicate (isDictTy)
import GHC.Platform
@ -474,9 +473,9 @@ getCompletions ideOpts CC { allModNamesAsNS, unqualCompls, qualCompls, importabl
-- The supported languages and extensions
languagesAndExts :: [T.Text]
#if MIN_GHC_API_VERSION(8,10,0)
languagesAndExts = map T.pack $ DynFlags.supportedLanguagesAndExtensions ( PlatformMini ArchUnknown OSUnknown )
languagesAndExts = map T.pack $ GHC.supportedLanguagesAndExtensions ( PlatformMini ArchUnknown OSUnknown )
#else
languagesAndExts = map T.pack DynFlags.supportedLanguagesAndExtensions
languagesAndExts = map T.pack GHC.supportedLanguagesAndExtensions
#endif
-- ---------------------------------------------------------------------

View File

@ -26,7 +26,6 @@ import GHC.Generics
import GHC
import Outputable hiding ((<>))
import DynFlags
import ConLike
import DataCon
import Var
@ -34,6 +33,7 @@ import NameEnv
import qualified Documentation.Haddock.Parser as H
import qualified Documentation.Haddock.Types as H
import Development.IDE.GHC.Compat
import Development.IDE.GHC.Orphans ()
type DocMap = NameEnv SpanDoc