Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
A Shake implementation of the compiler service, built using the Shaker abstraction layer for in-memory use.
Synopsis
- data IdeState
- data GetParsedModule = GetParsedModule
- newtype TransitiveDependencies = TransitiveDependencies {}
- data GhcSessionIO = GhcSessionIO
- data GetClientSettings = GetClientSettings
- runAction :: String -> IdeState -> Action a -> IO a
- toIdeResult :: Either [FileDiagnostic] v -> IdeResult v
- defineNoFile :: IdeRule k v => Recorder (WithPriority Log) -> (k -> Action v) -> Rules ()
- defineEarlyCutOffNoFile :: IdeRule k v => Recorder (WithPriority Log) -> (k -> Action (ByteString, v)) -> Rules ()
- mainRule :: Recorder (WithPriority Log) -> RulesConfig -> Rules ()
- data RulesConfig = RulesConfig {}
- getParsedModule :: NormalizedFilePath -> Action (Maybe ParsedModule)
- getParsedModuleWithComments :: NormalizedFilePath -> Action (Maybe ParsedModule)
- getClientConfigAction :: Action Config
- usePropertyAction :: HasProperty s k t r => KeyNameProxy s -> PluginId -> Properties r -> Action (ToHsType t)
- usePropertyByPathAction :: HasPropertyByPath props path t => KeyNamePath path -> PluginId -> Properties props -> Action (ToHsType t)
- getHieFile :: NormalizedFilePath -> Action (Maybe HieFile)
- newtype CompiledLinkables = CompiledLinkables {}
- getParsedModuleRule :: Recorder (WithPriority Log) -> Rules ()
- getParsedModuleWithCommentsRule :: Recorder (WithPriority Log) -> Rules ()
- getLocatedImportsRule :: Recorder (WithPriority Log) -> Rules ()
- reportImportCyclesRule :: Recorder (WithPriority Log) -> Rules ()
- typeCheckRule :: Recorder (WithPriority Log) -> Rules ()
- getDocMapRule :: Recorder (WithPriority Log) -> Rules ()
- loadGhcSession :: Recorder (WithPriority Log) -> GhcSessionDepsConfig -> Rules ()
- getModIfaceFromDiskRule :: Recorder (WithPriority Log) -> Rules ()
- getModIfaceRule :: Recorder (WithPriority Log) -> Rules ()
- getModSummaryRule :: LspT Config IO () -> Recorder (WithPriority Log) -> Rules ()
- getModuleGraphRule :: Recorder (WithPriority Log) -> Rules ()
- knownFilesRule :: Recorder (WithPriority Log) -> Rules ()
- getClientSettingsRule :: Recorder (WithPriority Log) -> Rules ()
- getHieAstsRule :: Recorder (WithPriority Log) -> Rules ()
- getBindingsRule :: Recorder (WithPriority Log) -> Rules ()
- needsCompilationRule :: NormalizedFilePath -> Action (IdeResultNoDiagnosticsEarlyCutoff (Maybe LinkableType))
- generateCoreRule :: Recorder (WithPriority Log) -> Rules ()
- getImportMapRule :: Recorder (WithPriority Log) -> Rules ()
- regenerateHiFile :: HscEnvEq -> NormalizedFilePath -> ModSummary -> Maybe LinkableType -> Action ([FileDiagnostic], Maybe HiFileResult)
- ghcSessionDepsDefinition :: Bool -> GhcSessionDepsConfig -> HscEnvEq -> NormalizedFilePath -> Action (Maybe HscEnvEq)
- getParsedModuleDefinition :: HscEnv -> IdeOptions -> NormalizedFilePath -> ModSummary -> IO ([FileDiagnostic], Maybe ParsedModule)
- typeCheckRuleDefinition :: HscEnv -> ParsedModule -> Action (IdeResult TcModuleResult)
- getRebuildCount :: Action Int
- getSourceFileSource :: NormalizedFilePath -> Action ByteString
- currentLinkables :: Action (ModuleEnv UTCTime)
- newtype GhcSessionDepsConfig = GhcSessionDepsConfig {}
- data Log
- newtype DisplayTHWarning = DisplayTHWarning (IO ())
Types
A Shake database plus persistent store. Can be thought of as storing
mappings from (FilePath, k)
to RuleResult k
.
Instances
MonadReader (ReactorChan, IdeState) (ServerM c) Source # | |
Defined in Development.IDE.LSP.Server ask :: ServerM c (ReactorChan, IdeState) # local :: ((ReactorChan, IdeState) -> (ReactorChan, IdeState)) -> ServerM c a -> ServerM c a # reader :: ((ReactorChan, IdeState) -> a) -> ServerM c a # |
data GetParsedModule Source #
Instances
newtype TransitiveDependencies Source #
TransitiveDependencies | |
|
Instances
data GhcSessionIO Source #
Instances
Generic GhcSessionIO Source # | |
Defined in Development.IDE.Core.RuleTypes type Rep GhcSessionIO :: Type -> Type # from :: GhcSessionIO -> Rep GhcSessionIO x # to :: Rep GhcSessionIO x -> GhcSessionIO # | |
Show GhcSessionIO Source # | |
Defined in Development.IDE.Core.RuleTypes showsPrec :: Int -> GhcSessionIO -> ShowS # show :: GhcSessionIO -> String # showList :: [GhcSessionIO] -> ShowS # | |
NFData GhcSessionIO Source # | |
Defined in Development.IDE.Core.RuleTypes rnf :: GhcSessionIO -> () # | |
Eq GhcSessionIO Source # | |
Defined in Development.IDE.Core.RuleTypes (==) :: GhcSessionIO -> GhcSessionIO -> Bool # (/=) :: GhcSessionIO -> GhcSessionIO -> Bool # | |
Hashable GhcSessionIO Source # | |
Defined in Development.IDE.Core.RuleTypes hashWithSalt :: Int -> GhcSessionIO -> Int # hash :: GhcSessionIO -> Int # | |
type Rep GhcSessionIO Source # | |
type RuleResult GhcSessionIO Source # | |
Defined in Development.IDE.Core.RuleTypes |
data GetClientSettings Source #
Get the client config stored in the ide state
Instances
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 => Recorder (WithPriority Log) -> (k -> Action v) -> Rules () Source #
defineEarlyCutOffNoFile :: IdeRule k v => Recorder (WithPriority Log) -> (k -> Action (ByteString, v)) -> Rules () Source #
mainRule :: Recorder (WithPriority Log) -> RulesConfig -> Rules () Source #
A rule that wires per-file rules together
data RulesConfig Source #
RulesConfig | |
|
Instances
Default RulesConfig Source # | |
Defined in Development.IDE.Core.Rules def :: RulesConfig # |
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 :: Action Config Source #
Returns the client configuration, creating a build dependency. You should always use this function when accessing client configuration from build rules.
usePropertyAction :: HasProperty s k t r => KeyNameProxy s -> PluginId -> Properties r -> Action (ToHsType t) Source #
usePropertyByPathAction :: HasPropertyByPath props path t => KeyNamePath path -> PluginId -> Properties props -> Action (ToHsType t) Source #
getHieFile :: NormalizedFilePath -> Action (Maybe HieFile) Source #
Get HieFile for haskell file on NormalizedFilePath
Rules
newtype CompiledLinkables Source #
Tracks which linkables are current, so we don't need to unload them
Instances
getParsedModuleRule :: Recorder (WithPriority Log) -> 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 :: Recorder (WithPriority Log) -> 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.
getLocatedImportsRule :: Recorder (WithPriority Log) -> Rules () Source #
reportImportCyclesRule :: Recorder (WithPriority Log) -> Rules () Source #
typeCheckRule :: Recorder (WithPriority Log) -> Rules () Source #
Typechecks a module.
getDocMapRule :: Recorder (WithPriority Log) -> Rules () Source #
loadGhcSession :: Recorder (WithPriority Log) -> GhcSessionDepsConfig -> Rules () Source #
getModIfaceFromDiskRule :: Recorder (WithPriority Log) -> 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.
getModIfaceRule :: Recorder (WithPriority Log) -> Rules () Source #
getModSummaryRule :: LspT Config IO () -> Recorder (WithPriority Log) -> Rules () Source #
getModuleGraphRule :: Recorder (WithPriority Log) -> Rules () Source #
knownFilesRule :: Recorder (WithPriority Log) -> Rules () Source #
getClientSettingsRule :: Recorder (WithPriority Log) -> Rules () Source #
getHieAstsRule :: Recorder (WithPriority Log) -> Rules () Source #
getBindingsRule :: Recorder (WithPriority Log) -> Rules () Source #
needsCompilationRule :: NormalizedFilePath -> Action (IdeResultNoDiagnosticsEarlyCutoff (Maybe LinkableType)) Source #
generateCoreRule :: Recorder (WithPriority Log) -> Rules () Source #
getImportMapRule :: Recorder (WithPriority Log) -> Rules () Source #
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
ghcSessionDepsDefinition Source #
:: Bool | full mod summary |
-> GhcSessionDepsConfig | |
-> HscEnvEq | |
-> NormalizedFilePath | |
-> Action (Maybe HscEnvEq) |
Note [GhcSessionDeps]
~~~~~~~~~~~~~~~~~~~~~
For a file Foo
, GhcSessionDeps "Foo.hs" results in an HscEnv which includes
1. HomeModInfo's (in the HUG/HPT) for all modules in the transitive closure of Foo, **NOT** including Foo itself.
2. ModSummary's (in the ModuleGraph) for all modules in the transitive closure of Foo, including Foo itself.
3. ModLocation's (in the FinderCache) all modules in the transitive closure of Foo, including Foo itself.
getParsedModuleDefinition :: HscEnv -> IdeOptions -> NormalizedFilePath -> ModSummary -> IO ([FileDiagnostic], Maybe ParsedModule) Source #
currentLinkables :: Action (ModuleEnv UTCTime) Source #
Get all the linkables stored in the graph, i.e. the ones we *do not* need to unload. Doesn't actually contain the code, since we don't need it to unload
newtype GhcSessionDepsConfig Source #
Instances
Default GhcSessionDepsConfig Source # | |
Defined in Development.IDE.Core.Rules |
newtype DisplayTHWarning Source #
DisplayTHWarning (IO ()) |
Instances
IsIdeGlobal DisplayTHWarning Source # | |
Defined in Development.IDE.Core.Rules |