ghcide-2.9.0.0: The core of an IDE

Safe Haskell | None
Language | GHC2021

Development.IDE.Types.Options

Description

Options

Synopsis

- data IdeOptions = IdeOptions {
  - optPreprocessor :: ParsedSource -> IdePreprocessedSource
  - optGhcSession :: Action IdeGhcSession
  - optPkgLocationOpts :: IdePkgLocationOptions
  - optExtensions :: [String]
  - optShakeProfiling :: Maybe FilePath
  - optTesting :: IdeTesting
  - optReportProgress :: IdeReportProgress
  - optMaxDirtyAge :: Int
  - optLanguageSyntax :: String
  - optNewColonConvention :: Bool
  - optKeywords :: [Text]
  - optDefer :: IdeDefer
  - optCheckProject :: IO Bool
  - optCheckParents :: IO CheckParents
  - optHaddockParse :: OptHaddockParse
  - optModifyDynFlags :: Config -> DynFlagsModifications
  - optShakeOptions :: ShakeOptions
  - optSkipProgress :: forall a. Typeable a => a -> Bool
  - optProgressStyle :: ProgressReportingStyle
  - optRunSubset :: Bool
  - optVerifyCoreFile :: Bool
  }
- data IdePreprocessedSource = IdePreprocessedSource {
  - preprocWarnings :: [(SrcSpan, String)]
  - preprocErrors :: [(SrcSpan, String)]
  - preprocSource :: ParsedSource
  }
- newtype IdeReportProgress = IdeReportProgress Bool
- newtype IdeDefer = IdeDefer Bool
- newtype IdeTesting = IdeTesting Bool
- newtype IdeOTMemoryProfiling = IdeOTMemoryProfiling Bool
- clientSupportsProgress :: ClientCapabilities -> IdeReportProgress
- data IdePkgLocationOptions = IdePkgLocationOptions {
  - optLocateHieFile :: UnitState -> Module -> IO (Maybe FilePath)
  - optLocateSrcFile :: UnitState -> Module -> IO (Maybe FilePath)
  }
- defaultIdeOptions :: Action IdeGhcSession -> IdeOptions
- type IdeResult v = ([FileDiagnostic], Maybe v)
- data IdeGhcSession = IdeGhcSession {
  - loadSessionFun :: FilePath -> IO (IdeResult HscEnvEq, [FilePath])
  - sessionVersion :: !Int
  }
- data OptHaddockParse
  - = HaddockParse
  - | NoHaddockParse
- data ProgressReportingStyle
  - = Percentage
  - | Explicit
  - | NoProgress

# Documentation

data IdeOptions #

Constructors

IdeOptions |

Fields

- optPreprocessor :: ParsedSource -> IdePreprocessedSource

  Preprocessor to run over all parsed source trees, generating a list of warnings and a list of errors, along with a new parse tree.

- optGhcSession :: Action IdeGhcSession

  Setup a GHC session for a given file, e.g. `Foo.hs`. For the same `ComponentOptions` from hie-bios, the resulting function will be applied once per file. It is desirable that many files get the same `HscEnvEq`, so that more IDE features work.

- optPkgLocationOpts :: IdePkgLocationOptions

  How to locate source and `.hie` files given a module name.

- optExtensions :: [String]

  File extensions to search for code, defaults to Haskell sources (including `.hs`)

- optShakeProfiling :: Maybe FilePath

  Set to `Just` to create a directory of profiling reports.

- optTesting :: IdeTesting

  Whether to enable additional lsp messages used by the test suite for checking invariants

- optReportProgress :: IdeReportProgress

  Whether to report progress during long operations.

- optMaxDirtyAge :: Int

  Age (in # builds) at which we collect dirty keys

- optLanguageSyntax :: String

  the ```language to use

- optNewColonConvention :: Bool

  whether to use new colon convention

- optKeywords :: [Text]

  keywords used for completions. These are customizable since DAML has a different set of keywords than Haskell.

- optDefer :: IdeDefer

  Whether to defer type errors, typed holes and out of scope variables. Deferral allows the IDE to continue to provide features such as diagnostics and go-to-definition, in situations in which they would become unavailable because of the presence of type errors, holes or unbound variables.

- optCheckProject :: IO Bool

  Whether to typecheck the entire project on load

- optCheckParents :: IO CheckParents

  When to typecheck reverse dependencies of a file

- optHaddockParse :: OptHaddockParse

  Whether to return result of parsing module with Opt_Haddock. Otherwise, return the result of parsing without Opt_Haddock, so that the parsed module contains the result of Opt_KeepRawTokenStream, which might be necessary for hlint.

- optModifyDynFlags :: Config -> DynFlagsModifications

  Will be called right after setting up a new cradle, allowing to customize the Ghc options used

- optShakeOptions :: ShakeOptions
- optSkipProgress :: forall a. Typeable a => a -> Bool

  Predicate to select which rule keys to exclude from progress reporting.

- optProgressStyle :: ProgressReportingStyle
- optRunSubset :: Bool

  Experimental feature to re-run only the subset of the Shake graph that has changed

- optVerifyCoreFile :: Bool

  Verify core files after serialization

data IdePreprocessedSource #

Constructors

IdePreprocessedSource |

Fields

- preprocWarnings :: [(SrcSpan, String)]

  Warnings emitted by the preprocessor.

- preprocErrors :: [(SrcSpan, String)]

  Errors emitted by the preprocessor.

- preprocSource :: ParsedSource

  New parse tree emitted by the preprocessor.

newtype IdeReportProgress #

Constructors

IdeReportProgress Bool |

newtype IdeDefer #

Constructors

IdeDefer Bool |

newtype IdeTesting #

Constructors

IdeTesting Bool |

newtype IdeOTMemoryProfiling #

Constructors

IdeOTMemoryProfiling Bool |

clientSupportsProgress :: ClientCapabilities -> IdeReportProgress #

data IdePkgLocationOptions #

The set of options used to locate files belonging to external packages.

Constructors

IdePkgLocationOptions |

Fields

- optLocateHieFile :: UnitState -> Module -> IO (Maybe FilePath)

  Locate the HIE file for the given module. The PackageConfig can be used to lookup settings like importDirs.

- optLocateSrcFile :: UnitState -> Module -> IO (Maybe FilePath)

  Locate the source file for the given module. The PackageConfig can be used to lookup settings like importDirs. For DAML, we place them in the package DB. For cabal this could point somewhere in ~.cabalpackages.

defaultIdeOptions :: Action IdeGhcSession -> IdeOptions #

type IdeResult v = ([FileDiagnostic], Maybe v) #

The result of an IDE operation. Warnings and errors are in the Diagnostic, and a value is in the Maybe. For operations that throw an error you expect a non-empty list of diagnostics, at least one of which is an error, and a Nothing. For operations that succeed you expect perhaps some warnings and a Just. For operations that depend on other failing operations you may get empty diagnostics and a Nothing, to indicate this phase throws no fresh errors but still failed.

A rule on a file should only return diagnostics for that given file. It should not propagate diagnostic errors through multiple phases.

data IdeGhcSession #

Constructors

IdeGhcSession |

Fields

- loadSessionFun :: FilePath -> IO (IdeResult HscEnvEq, [FilePath])

  Returns the Ghc session and the cradle dependencies

- sessionVersion :: !Int

  Used as Shake key, versions must be unique and not reused

#### Instances

Instances details

NFData IdeGhcSession # |
Instance details Defined in Development.IDE.Core.RuleTypes Methods rnf :: IdeGhcSession -> () #
Show IdeGhcSession # |
Instance details Defined in Development.IDE.Core.RuleTypes Methods showsPrec :: Int -> IdeGhcSession -> ShowS # show :: IdeGhcSession -> String # showList :: [IdeGhcSession] -> ShowS #

data OptHaddockParse #

Constructors

HaddockParse |
NoHaddockParse |

#### Instances

Instances details

Enum OptHaddockParse # |

Instance details

Defined in Development.IDE.Types.Options

Methods

succ :: OptHaddockParse -> OptHaddockParse #

pred :: OptHaddockParse -> OptHaddockParse #

toEnum :: Int -> OptHaddockParse #

fromEnum :: OptHaddockParse -> Int #

enumFrom :: OptHaddockParse -> [OptHaddockParse] #

enumFromThen :: OptHaddockParse -> OptHaddockParse -> [OptHaddockParse] #

enumFromTo :: OptHaddockParse -> OptHaddockParse -> [OptHaddockParse] #

enumFromThenTo :: OptHaddockParse -> OptHaddockParse -> OptHaddockParse -> [OptHaddockParse] #

Show OptHaddockParse # |
Instance details Defined in Development.IDE.Types.Options Methods showsPrec :: Int -> OptHaddockParse -> ShowS # show :: OptHaddockParse -> String # showList :: [OptHaddockParse] -> ShowS #
Eq OptHaddockParse # |
Instance details Defined in Development.IDE.Types.Options Methods (==) :: OptHaddockParse -> OptHaddockParse -> Bool # (/=) :: OptHaddockParse -> OptHaddockParse -> Bool #
Ord OptHaddockParse # |

Instance details

Defined in Development.IDE.Types.Options

Methods

compare :: OptHaddockParse -> OptHaddockParse -> Ordering #

(<) :: OptHaddockParse -> OptHaddockParse -> Bool #

(<=) :: OptHaddockParse -> OptHaddockParse -> Bool #

(>) :: OptHaddockParse -> OptHaddockParse -> Bool #

(>=) :: OptHaddockParse -> OptHaddockParse -> Bool #

max :: OptHaddockParse -> OptHaddockParse -> OptHaddockParse #

min :: OptHaddockParse -> OptHaddockParse -> OptHaddockParse #

data ProgressReportingStyle #

Constructors

Percentage | Report using the LSP `_percentage` field
Explicit | Report using explicit 123/456 text
NoProgress | Do not report any percentage

#### Instances

Instances details

Eq ProgressReportingStyle # |
Instance details Defined in Development.IDE.Types.Options Methods (==) :: ProgressReportingStyle -> ProgressReportingStyle -> Bool # (/=) :: ProgressReportingStyle -> ProgressReportingStyle -> Bool #