ide-backend-0.10.0: An IDE backend library

Safe HaskellNone




data SessionConfig Source

Configuration parameters for a session. These remain the same throughout the whole session's lifetime.




configDir :: FilePath

The directory to use for all session files.

configLocalWorkingDir :: Maybe FilePath

When set to Just "filepath", we'll use the files in that directory as source and datafiles. This means that the ide-backend is no longer directly managing the files, and file updates like updateSourceFile will fail.

Note that this feature is experimental and does not have a suite of tests.

Since this is likely used with an existing cabal project, which might have multiple source directories, you'll likely want to use TargetsInclude instead of TargetsExclude.

configExtraPathDirs :: [FilePath]

Extra directories in which to look for programs, including ghc and other tools. Note that the $PATH is still searched first, these directories are extra.

configInProcess :: InProcess

Should the GHC client run in-process? NOTE: This is currently broken. Set to False.

configGenerateModInfo :: Bool

Whether to generate module type/autocompletion info.

configPackageDBStack :: PackageDBStack

Package DBs to consult

configLicenseExc :: [String]

Packages that don't need the .cabal files provided for license concatenation (e.g., because they are covered by the core license set).

configLicenseFixed :: [(String, (Maybe License, Maybe FilePath, Maybe String))]

Hard-coded package licence information, e.g., for the packages that always stay installed in-place in the GHC tree, so it's troublesome to automatically retrieve their .cabal files.

configLog :: String -> IO ()

Function to be used for logging. Messages logged in this manner may be provided to users in a special debugging UI.

configDeleteTempFiles :: Bool

Delete temporary files when session finishes? (Defaults to True; mostly for internal debugging purposes)

configIdeBackendServer :: (ProgramSearchPath, FilePath)

The name of the ide-backend-server program to use, and where to find it. The default is (defaultProgramSearchPath,"ide-backend-server"), that is, to look for a program called ide-backend-server on the system search path only.

configIdeBackendExeCabal :: (ProgramSearchPath, FilePath)

The name of the ide-backend-exe-cabal program to use, and where to find it. The default is (defaultProgramSearchPath,"ide-backend-exe-cabal").

type ProgramSearchPath = [ProgramSearchPathEntry]

A search path to use when locating executables. This is analogous to the unix $PATH or win32 %PATH% but with the ability to use the system default method for finding executables (findExecutable which on unix is simply looking on the $PATH but on win32 is a bit more complicated).

The default to use is [ProgSearchPathDefault] but you can add extra dirs either before, after or instead of the default, e.g. here we add an extra dir to search after the usual ones.

['ProgramSearchPathDefault', 'ProgramSearchPathDir' dir]

data ProgramSearchPathEntry :: *


ProgramSearchPathDir FilePath

A specific dir


The system default

defaultSessionConfig :: SessionConfig Source

Default session configuration. Most users will probably instead want localSessionConfigFromEnv.

Use this instead of creating your own SessionConfig to be robust against extensions of SessionConfig.

defaultSessionConfig = SessionConfig {
    configDir              = "."
  , configLocalWorkingDir  = Nothing
  , configExtraPathDirs    = []
  , configInProcess        = False
  , configGenerateModInfo  = True
  , configPackageDBStack   = [GlobalPackageDB, UserPackageDB]
    -- ghc-prim, integer-gmp, etc., all have their own licenses specified
    -- in their .cabal files.
  , configLicenseExc       = ["rts"]
  , configLicenseFixed     = [
        ("bin-package-db", (Just BSD3, Nothing,           Nothing))
      , ("ghc",            (Just BSD3, Just "../LICENSE", Just "The GHC Team"))
      , ("ghc-prim",       (Just BSD3, Just "LICENSE",    Nothing))
      , ("integer-gmp",    (Just BSD3, Just "LICENSE",    Nothing))
  , configLog              = const $ return ()
  , configDeleteTempFiles  = True
  , configIdeBackendServer = (defaultProgramSearchPath,"ide-backend-server")
  , configIdeBackendExeCabal = (defaultProgramSearchPath,"ide-backend-exe-cabal")