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 #-}
7module Development.IDE.Types.Options
9 , IdePkgLocationOptions(..)
10 , InterfaceDirectory(..)
14import Development.Shake
15import GHC hiding (parseModule, typecheckModule)
16import GhcPlugins as GHC hiding (fst3, (<>))
19-- | If `Nothing` we do not write .hi files.
20newtype InterfaceDirectory = InterfaceDirectory (Maybe FilePath)
22data IdeOptions = IdeOptions
23 { optPreprocessor :: GHC.ParsedSource -> ([(GHC.SrcSpan, String)], GHC.ParsedSource)
24 , optGhcSession :: Action HscEnv
25 -- ^ Setup a GHC session using a given package state. If a `ParsedModule` is supplied,
26 -- the import path should be setup for that module.
27 , optPkgLocationOpts :: IdePkgLocationOptions
28 , optIfaceDir :: InterfaceDirectory
29 , optExtensions :: [String]
32 , optShakeProfiling :: Maybe FilePath
33 , optLanguageSyntax :: String -- ^ the ```language to use
34 , optNewColonConvention :: Bool -- ^ whether to use new colon convention
37defaultIdeOptions :: Action HscEnv -> IdeOptions
38defaultIdeOptions session = IdeOptions
39 {optPreprocessor = (,) []
40 ,optIfaceDir = InterfaceDirectory Nothing
41 ,optGhcSession = session
42 ,optExtensions = ["hs"]
43 ,optPkgLocationOpts = defaultIdePkgLocationOptions
45 ,optShakeProfiling = Nothing
46 ,optLanguageSyntax = "haskell"
47 ,optNewColonConvention = False
51-- | The set of options used to locate files belonging to external packages.
52data IdePkgLocationOptions = IdePkgLocationOptions
53 { optLocateHieFile :: PackageConfig -> Module -> IO (Maybe FilePath)
54 -- ^ Locate the HIE file for the given module. The PackageConfig can be
55 -- used to lookup settings like importDirs.
56 , optLocateSrcFile :: PackageConfig -> Module -> IO (Maybe FilePath)
57 -- ^ Locate the source file for the given module. The PackageConfig can be
58 -- used to lookup settings like importDirs. For DAML, we place them in the package DB.
59 -- For cabal this could point somewhere in ~/.cabal/packages.
62defaultIdePkgLocationOptions :: IdePkgLocationOptions
63defaultIdePkgLocationOptions = IdePkgLocationOptions f f
64 where f _ _ = return Nothing
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list