on cb7d95e help sign in
45 lines 1.7 kB history raw
1-- Copyright (c) 2019 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
2-- SPDX-License-Identifier: Apache-2.0
4{-# LANGUAGE RankNTypes #-}
6-- | Options
7module Development.IDE.Types.Options
8 ( IdeOptions(..)
9 , IdePkgLocationOptions(..)
10 , defaultIdePkgLocationOptions
11 ) where
13import Development.Shake
14import GHC hiding (parseModule, typecheckModule)
15import GhcPlugins as GHC hiding (fst3, (<>))
18data IdeOptions = IdeOptions
19 { optPreprocessor :: GHC.ParsedSource -> ([(GHC.SrcSpan, String)], GHC.ParsedSource)
20 , optGhcSession :: Action HscEnv
21 -- ^ Setup a GHC session using a given package state. If a `ParsedModule` is supplied,
22 -- the import path should be setup for that module.
23 , optPkgLocationOpts :: IdePkgLocationOptions
24 , optWriteIface :: Bool
25 , optExtensions :: [String]
27 , optThreads :: Int
28 , optShakeProfiling :: Maybe FilePath
29 }
32-- | The set of options used to locate files belonging to external packages.
33data IdePkgLocationOptions = IdePkgLocationOptions
34 { optLocateHieFile :: PackageConfig -> Module -> IO (Maybe FilePath)
35 -- ^ Locate the HIE file for the given module. The PackageConfig can be
36 -- used to lookup settings like importDirs.
37 , optLocateSrcFile :: PackageConfig -> Module -> IO (Maybe FilePath)
38 -- ^ Locate the source file for the given module. The PackageConfig can be
39 -- used to lookup settings like importDirs. For DAML, we place them in the package DB.
40 -- For cabal this could point somewhere in ~/.cabal/packages.
41 }
43defaultIdePkgLocationOptions :: IdePkgLocationOptions
44defaultIdePkgLocationOptions = IdePkgLocationOptions f f
45 where f _ _ = return Nothing