ghcide-1.2.0.2: The core of an IDE
Safe HaskellNone
LanguageHaskell2010

Development.IDE.Core.Rules

Description

A Shake implementation of the compiler service, built using the Shaker abstraction layer for in-memory use.

Synopsis

Types

data IdeState Source #

A Shake database plus persistent store. Can be thought of as storing mappings from (FilePath, k) to RuleResult k.

data GetDependencies Source #

Constructors

GetDependencies 

Instances

Instances details
Eq GetDependencies Source # 
Instance details

Defined in Development.IDE.Core.RuleTypes

Show GetDependencies Source # 
Instance details

Defined in Development.IDE.Core.RuleTypes

Generic GetDependencies Source # 
Instance details

Defined in Development.IDE.Core.RuleTypes

Associated Types

type Rep GetDependencies :: Type -> Type #

Hashable GetDependencies Source # 
Instance details

Defined in Development.IDE.Core.RuleTypes

Binary GetDependencies Source # 
Instance details

Defined in Development.IDE.Core.RuleTypes

NFData GetDependencies Source # 
Instance details

Defined in Development.IDE.Core.RuleTypes

Methods

rnf :: GetDependencies -> () #

type Rep GetDependencies Source # 
Instance details

Defined in Development.IDE.Core.RuleTypes

type Rep GetDependencies = D1 ('MetaData "GetDependencies" "Development.IDE.Core.RuleTypes" "ghcide-1.2.0.2-BbWZU1s5vBuj0MYL7ZBIZ" 'False) (C1 ('MetaCons "GetDependencies" 'PrefixI 'False) (U1 :: Type -> Type))
type RuleResult GetDependencies Source #

Transitive module and pkg dependencies based on the information produced by GetDependencyInformation. This rule is also responsible for calling ReportImportCycles for each file in the transitive closure.

Instance details

Defined in Development.IDE.Core.RuleTypes

data GetParsedModule Source #

Constructors

GetParsedModule 

Instances

Instances details
Eq GetParsedModule Source # 
Instance details

Defined in Development.IDE.Core.RuleTypes

Show GetParsedModule Source # 
Instance details

Defined in Development.IDE.Core.RuleTypes

Generic GetParsedModule Source # 
Instance details

Defined in Development.IDE.Core.RuleTypes

Associated Types

type Rep GetParsedModule :: Type -> Type #

Hashable GetParsedModule Source # 
Instance details

Defined in Development.IDE.Core.RuleTypes

Binary GetParsedModule Source # 
Instance details

Defined in Development.IDE.Core.RuleTypes

NFData GetParsedModule Source # 
Instance details

Defined in Development.IDE.Core.RuleTypes

Methods

rnf :: GetParsedModule -> () #

type Rep GetParsedModule Source # 
Instance details

Defined in Development.IDE.Core.RuleTypes

type Rep GetParsedModule = D1 ('MetaData "GetParsedModule" "Development.IDE.Core.RuleTypes" "ghcide-1.2.0.2-BbWZU1s5vBuj0MYL7ZBIZ" 'False) (C1 ('MetaCons "GetParsedModule" 'PrefixI 'False) (U1 :: Type -> Type))
type RuleResult GetParsedModule Source #

The parse tree for the file using GetFileContents

Instance details

Defined in Development.IDE.Core.RuleTypes

newtype TransitiveDependencies Source #

Constructors

TransitiveDependencies 

Fields

newtype Priority Source #

Constructors

Priority Double 

data GhcSessionIO Source #

Constructors

GhcSessionIO 

Instances

Instances details
Eq GhcSessionIO Source # 
Instance details

Defined in Development.IDE.Core.RuleTypes

Show GhcSessionIO Source # 
Instance details

Defined in Development.IDE.Core.RuleTypes

Generic GhcSessionIO Source # 
Instance details

Defined in Development.IDE.Core.RuleTypes

Associated Types

type Rep GhcSessionIO :: Type -> Type #

Hashable GhcSessionIO Source # 
Instance details

Defined in Development.IDE.Core.RuleTypes

Binary GhcSessionIO Source # 
Instance details

Defined in Development.IDE.Core.RuleTypes

NFData GhcSessionIO Source # 
Instance details

Defined in Development.IDE.Core.RuleTypes

Methods

rnf :: GhcSessionIO -> () #

type Rep GhcSessionIO Source # 
Instance details

Defined in Development.IDE.Core.RuleTypes

type Rep GhcSessionIO = D1 ('MetaData "GhcSessionIO" "Development.IDE.Core.RuleTypes" "ghcide-1.2.0.2-BbWZU1s5vBuj0MYL7ZBIZ" 'False) (C1 ('MetaCons "GhcSessionIO" 'PrefixI 'False) (U1 :: Type -> Type))
type RuleResult GhcSessionIO Source # 
Instance details

Defined in Development.IDE.Core.RuleTypes

data GetClientSettings Source #

Get the vscode client settings stored in the ide state

Constructors

GetClientSettings 

Instances

Instances details
Eq GetClientSettings Source # 
Instance details

Defined in Development.IDE.Core.RuleTypes

Show GetClientSettings Source # 
Instance details

Defined in Development.IDE.Core.RuleTypes

Generic GetClientSettings Source # 
Instance details

Defined in Development.IDE.Core.RuleTypes

Associated Types

type Rep GetClientSettings :: Type -> Type #

Hashable GetClientSettings Source # 
Instance details

Defined in Development.IDE.Core.RuleTypes

Binary GetClientSettings Source # 
Instance details

Defined in Development.IDE.Core.RuleTypes

NFData GetClientSettings Source # 
Instance details

Defined in Development.IDE.Core.RuleTypes

Methods

rnf :: GetClientSettings -> () #

type Rep GetClientSettings Source # 
Instance details

Defined in Development.IDE.Core.RuleTypes

type Rep GetClientSettings = D1 ('MetaData "GetClientSettings" "Development.IDE.Core.RuleTypes" "ghcide-1.2.0.2-BbWZU1s5vBuj0MYL7ZBIZ" 'False) (C1 ('MetaCons "GetClientSettings" 'PrefixI 'False) (U1 :: Type -> Type))
type RuleResult GetClientSettings Source # 
Instance details

Defined in Development.IDE.Core.RuleTypes

Functions

toIdeResult :: Either [FileDiagnostic] v -> IdeResult v Source #

This is useful for rules to convert rules that can only produce errors or a result into the more general IdeResult type that supports producing warnings while also producing a result.

defineNoFile :: IdeRule k v => (k -> Action v) -> Rules () Source #

mainRule :: Rules () Source #

A rule that wires per-file rules together

getDependencies :: NormalizedFilePath -> Action (Maybe [NormalizedFilePath]) Source #

Get all transitive file dependencies of a given module. Does not include the file itself.

getParsedModule :: NormalizedFilePath -> Action (Maybe ParsedModule) Source #

Parse the contents of a haskell file.

getParsedModuleWithComments :: NormalizedFilePath -> Action (Maybe ParsedModule) Source #

Parse the contents of a haskell file, ensuring comments are preserved in annotations

getClientConfigAction Source #

Arguments

:: Config

default value

-> Action Config 

Returns the client configurarion stored in the IdeState. You can use this function to access it from shake Rules

Rules

newtype CompiledLinkables Source #

Tracks which linkables are current, so we don't need to unload them

Instances

Instances details
IsIdeGlobal CompiledLinkables Source # 
Instance details

Defined in Development.IDE.Core.Rules

data IsHiFileStable Source #

Given the path to a module src file, this rule returns True if the corresponding `.hi` file is stable, that is, if it is newer than the src file, and all its dependencies are stable too.

Constructors

IsHiFileStable 

Instances

Instances details
Eq IsHiFileStable Source # 
Instance details

Defined in Development.IDE.Core.Rules

Show IsHiFileStable Source # 
Instance details

Defined in Development.IDE.Core.Rules

Generic IsHiFileStable Source # 
Instance details

Defined in Development.IDE.Core.Rules

Associated Types

type Rep IsHiFileStable :: Type -> Type #

Hashable IsHiFileStable Source # 
Instance details

Defined in Development.IDE.Core.Rules

Binary IsHiFileStable Source # 
Instance details

Defined in Development.IDE.Core.Rules

NFData IsHiFileStable Source # 
Instance details

Defined in Development.IDE.Core.Rules

Methods

rnf :: IsHiFileStable -> () #

type Rep IsHiFileStable Source # 
Instance details

Defined in Development.IDE.Core.Rules

type Rep IsHiFileStable = D1 ('MetaData "IsHiFileStable" "Development.IDE.Core.Rules" "ghcide-1.2.0.2-BbWZU1s5vBuj0MYL7ZBIZ" 'False) (C1 ('MetaCons "IsHiFileStable" 'PrefixI 'False) (U1 :: Type -> Type))
type RuleResult IsHiFileStable Source # 
Instance details

Defined in Development.IDE.Core.Rules

getParsedModuleRule :: Rules () Source #

WARNING: We currently parse the module both with and without Opt_Haddock, and return the one with Haddocks if it -- succeeds. However, this may not work for hlint or any client code that might need the parsed source with all annotations, including comments. For that use case you might want to use getParsedModuleWithCommentsRule See https://github.com/haskell/ghcide/pull/350#discussion_r370878197 and https://github.com/mpickering/ghcide/pull/22#issuecomment-625070490 GHC wiki about: https://gitlab.haskell.org/ghc/ghc/-/wikis/api-annotations

getParsedModuleWithCommentsRule :: Rules () Source #

This rule provides a ParsedModule preserving all annotations, including keywords, punctuation and comments. So it is suitable for use cases where you need a perfect edit.

typeCheckRule :: Rules () Source #

Typechecks a module.

getModIfaceFromDiskRule :: Rules () Source #

Load a iface from disk, or generate it if there isn't one or it is out of date This rule also ensures that the `.hie` and `.o` (if needed) files are written out.

regenerateHiFile :: HscEnvEq -> NormalizedFilePath -> ModSummary -> Maybe LinkableType -> Action ([FileDiagnostic], Maybe HiFileResult) Source #

Also generates and indexes the `.hie` file, along with the `.o` file if needed Invariant maintained is that if the `.hi` file was successfully written, then the `.hie` and `.o` file (if needed) were also successfully written