Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data ParseResult a
- data NormalizedUri
- type DiagnosticStore = HashMap NormalizedUri StoreItem
- data Diagnostic = Diagnostic {}
- data DiagnosticSeverity
- data Location = Location {}
- data Range = Range {}
- data Position = Position {
- _line :: Int
- _character :: Int
- fromNormalizedFilePath :: NormalizedFilePath -> FilePath
- fromNormalizedUri :: NormalizedUri -> Uri
- toNormalizedUri :: Uri -> NormalizedUri
- newtype Uri = Uri {}
- data NormalizedFilePath
- newtype List a = List [a]
- action :: Partial => Action a -> Rules ()
- data Rules a
- type family RuleResult key
- data Action a
- setHieDir :: FilePath -> DynFlags -> DynFlags
- dontWriteHieFiles :: DynFlags -> DynFlags
- disableWarningsAsErrors :: DynFlags -> DynFlags
- toNormalizedFilePath' :: FilePath -> NormalizedFilePath
- emptyFilePath :: NormalizedFilePath
- uriToFilePath' :: Uri -> Maybe FilePath
- emptyPathUri :: NormalizedUri
- filePathToUri' :: NormalizedFilePath -> NormalizedUri
- fromUri :: NormalizedUri -> NormalizedFilePath
- noFilePath :: FilePath
- noRange :: Range
- showPosition :: Position -> String
- readSrcSpan :: ReadS RealSrcSpan
- type FileDiagnostic = (NormalizedFilePath, ShowDiagnostic, Diagnostic)
- data ShowDiagnostic
- type IdeResult v = ([FileDiagnostic], Maybe v)
- ideErrorText :: NormalizedFilePath -> Text -> FileDiagnostic
- ideErrorWithSource :: Maybe DiagnosticSource -> Maybe DiagnosticSeverity -> a -> Text -> (a, ShowDiagnostic, Diagnostic)
- showDiagnostics :: [FileDiagnostic] -> Text
- showDiagnosticsColored :: [FileDiagnostic] -> Text
- modifyDynFlags :: GhcMonad m => (DynFlags -> DynFlags) -> m ()
- lookupPackageConfig :: UnitId -> HscEnv -> Maybe PackageConfig
- textToStringBuffer :: Text -> StringBuffer
- runParser :: DynFlags -> String -> P a -> ParseResult a
- stringBufferToByteString :: StringBuffer -> ByteString
- bytestringToStringBuffer :: ByteString -> StringBuffer
- prettyPrint :: Outputable a => a -> String
- unsafePrintSDoc :: SDoc -> String
- printRdrName :: RdrName -> String
- printName :: Name -> String
- evalGhcEnv :: HscEnv -> Ghc b -> IO b
- moduleImportPath :: NormalizedFilePath -> ModuleName -> Maybe FilePath
- readFileUtf8 :: FilePath -> IO Text
- cgGutsToCoreModule :: SafeHaskellMode -> CgGuts -> ModDetails -> CoreModule
- fingerprintToBS :: Fingerprint -> ByteString
- fingerprintFromStringBuffer :: StringBuffer -> IO Fingerprint
- hDuplicateTo' :: Handle -> Handle -> IO ()
- diagFromErrMsg :: Text -> DynFlags -> ErrMsg -> [FileDiagnostic]
- diagFromErrMsgs :: Text -> DynFlags -> Bag ErrMsg -> [FileDiagnostic]
- srcSpanToRange :: SrcSpan -> Maybe Range
- realSrcSpanToRange :: RealSrcSpan -> Range
- realSrcLocToPosition :: RealSrcLoc -> Position
- srcSpanToFilename :: SrcSpan -> Maybe FilePath
- realSrcSpanToLocation :: RealSrcSpan -> Location
- srcSpanToLocation :: SrcSpan -> Maybe Location
- rangeToSrcSpan :: NormalizedFilePath -> Range -> SrcSpan
- rangeToRealSrcSpan :: NormalizedFilePath -> Range -> RealSrcSpan
- positionToRealSrcLoc :: NormalizedFilePath -> Position -> RealSrcLoc
- isInsideSrcSpan :: Position -> SrcSpan -> Bool
- toDSeverity :: Severity -> Maybe DiagnosticSeverity
- diagFromStrings :: Text -> DiagnosticSeverity -> [(SrcSpan, String)] -> [FileDiagnostic]
- diagFromString :: Text -> DiagnosticSeverity -> SrcSpan -> String -> [FileDiagnostic]
- noSpan :: String -> SrcSpan
- zeroSpan :: FastString -> RealSrcSpan
- realSpan :: SrcSpan -> Maybe RealSrcSpan
- catchSrcErrors :: DynFlags -> Text -> IO a -> IO (Either [FileDiagnostic] a)
- diagFromGhcException :: Text -> DynFlags -> GhcException -> [FileDiagnostic]
- data HscEnvEq
- hscEnvWithImportPaths :: HscEnvEq -> HscEnv
- data Logger = Logger {
- logPriority :: Priority -> Text -> IO ()
- data Priority
- logError :: Logger -> Text -> IO ()
- logWarning :: Logger -> Text -> IO ()
- logInfo :: Logger -> Text -> IO ()
- logDebug :: Logger -> Text -> IO ()
- logTelemetry :: Logger -> Text -> IO ()
- noLogging :: Logger
- data GhcSessionIO = GhcSessionIO
- data GetClientSettings = GetClientSettings
- data GetModSummary = GetModSummary
- data GetModSummaryWithoutTimestamps = GetModSummaryWithoutTimestamps
- data IsFileOfInterest = IsFileOfInterest
- data GetModIfaceWithoutLinkable = GetModIfaceWithoutLinkable
- data GetModIface = GetModIface
- data GetModIfaceFromDiskAndIndex = GetModIfaceFromDiskAndIndex
- data GetModIfaceFromDisk = GetModIfaceFromDisk
- data GhcSessionDeps = GhcSessionDeps
- data GhcSession = GhcSession
- data GetBindings = GetBindings
- data GetHieAst = GetHieAst
- data GetDocMap = GetDocMap
- data TypeCheck = TypeCheck
- data GetDependencies = GetDependencies
- data ReportImportCycles = ReportImportCycles
- data GetModuleGraph = GetModuleGraph
- data GetDependencyInformation = GetDependencyInformation
- data NeedsCompilation = NeedsCompilation
- data GetLocatedImports = GetLocatedImports
- data GetParsedModuleWithComments = GetParsedModuleWithComments
- data GetParsedModule = GetParsedModule
- data IsFileOfInterestResult
- data FileOfInterestStatus
- data GetFileContents = GetFileContents
- data FileVersion
- = VFSVersion !Int
- | ModificationTime !Int64 !Int64
- data GetModificationTime = GetModificationTime_ {}
- data DocAndKindMap = DKMap {
- getDocMap :: !DocMap
- getKindMap :: !KindMap
- data HieKind a where
- data HieAstResult = forall a. HAR {}
- data HiFileResult = HiFileResult {}
- data TcModuleResult = TcModuleResult {}
- data Splices = Splices {
- exprSplices :: [(LHsExpr GhcTc, LHsExpr GhcPs)]
- patSplices :: [(LHsExpr GhcTc, LPat GhcPs)]
- typeSplices :: [(LHsExpr GhcTc, LHsType GhcPs)]
- declSplices :: [(LHsExpr GhcTc, [LHsDecl GhcPs])]
- awSplices :: [(LHsExpr GhcTc, Serialized)]
- newtype ImportMap = ImportMap {}
- data GetImportMap = GetImportMap
- data GenerateCore = GenerateCore
- data GetKnownTargets = GetKnownTargets
- data LinkableType
- pattern GetModificationTime :: GetModificationTime
- tmrModSummary :: TcModuleResult -> ModSummary
- hiFileFingerPrint :: HiFileResult -> ByteString
- hirModIface :: HiFileResult -> ModIface
- vfsVersion :: FileVersion -> Maybe Int
- awSplicesL :: Lens' Splices [(LHsExpr GhcTc, Serialized)]
- declSplicesL :: Lens' Splices [(LHsExpr GhcTc, [LHsDecl GhcPs])]
- exprSplicesL :: Lens' Splices [(LHsExpr GhcTc, LHsExpr GhcPs)]
- patSplicesL :: Lens' Splices [(LHsExpr GhcTc, LPat GhcPs)]
- typeSplicesL :: Lens' Splices [(LHsExpr GhcTc, LHsType GhcPs)]
- data FastResult a = FastResult {}
- newtype IdeAction a = IdeAction {}
- data IdeState
- type IdeRule k v = (RuleResult k ~ v, ShakeValue k, Show v, Typeable v, NFData v)
- data ShakeExtras
- define :: IdeRule k v => (k -> NormalizedFilePath -> Action (IdeResult v)) -> Rules ()
- use :: IdeRule k v => k -> NormalizedFilePath -> Action (Maybe v)
- useWithStale :: IdeRule k v => k -> NormalizedFilePath -> Action (Maybe (v, PositionMapping))
- useWithStale_ :: IdeRule k v => k -> NormalizedFilePath -> Action (v, PositionMapping)
- runIdeAction :: String -> ShakeExtras -> IdeAction a -> IO a
- useWithStaleFast :: IdeRule k v => k -> NormalizedFilePath -> IdeAction (Maybe (v, PositionMapping))
- useWithStaleFast' :: IdeRule k v => k -> NormalizedFilePath -> IdeAction (FastResult v)
- useNoFile :: IdeRule k v => k -> Action (Maybe v)
- use_ :: IdeRule k v => k -> NormalizedFilePath -> Action v
- useNoFile_ :: IdeRule k v => k -> Action v
- uses_ :: IdeRule k v => k -> [NormalizedFilePath] -> Action [v]
- uses :: IdeRule k v => k -> [NormalizedFilePath] -> Action [Maybe v]
- defineEarlyCutoff :: IdeRule k v => (k -> NormalizedFilePath -> Action (Maybe ByteString, IdeResult v)) -> Rules ()
- ideLogger :: IdeState -> Logger
- actionLogger :: Action Logger
- data Plugin c = Plugin {
- pluginRules :: Rules ()
- pluginHandlers :: Handlers (ServerM c)
- getFilesOfInterest :: Action (HashMap NormalizedFilePath FileOfInterestStatus)
- data IdeConfiguration = IdeConfiguration {}
- isWorkspaceFile :: NormalizedFilePath -> Action Bool
- getFileContents :: NormalizedFilePath -> Action (UTCTime, Maybe Text)
- getFileExists :: NormalizedFilePath -> Action Bool
- runAction :: String -> IdeState -> Action a -> IO a
- getAtPoint :: NormalizedFilePath -> Position -> IdeAction (Maybe (Maybe Range, [Text]))
- getDefinition :: NormalizedFilePath -> Position -> IdeAction (Maybe [Location])
- getTypeDefinition :: NormalizedFilePath -> Position -> IdeAction (Maybe [Location])
- getParsedModule :: NormalizedFilePath -> Action (Maybe ParsedModule)
- getClientConfigAction :: Config -> Action Config
Documentation
data ParseResult a #
The result of running a parser.
POk | The parser has consumed a (possibly empty) prefix
of the input and produced a result. Use |
| |
PFailed | The parser has consumed a (possibly empty) prefix of the input and failed. |
|
data NormalizedUri #
Instances
data Diagnostic #
Diagnostic | |
|
Instances
data DiagnosticSeverity #
Instances
Instances
Eq Location | |
Ord Location | |
Defined in Language.LSP.Types.Location | |
Read Location | |
Show Location | |
Generic Location | |
ToJSON Location | |
Defined in Language.LSP.Types.Location | |
FromJSON Location | |
NFData Location | |
Defined in Language.LSP.Types.Location | |
HasLocation DiagnosticRelatedInformation Location | |
Defined in Language.LSP.Types.Lens | |
HasLocation SymbolInformation Location | |
Defined in Language.LSP.Types.Lens | |
HasRange Location Range | |
HasUri Location Uri | |
type Rep Location | |
Defined in Language.LSP.Types.Location type Rep Location = D1 ('MetaData "Location" "Language.LSP.Types.Location" "lsp-types-1.1.0.0-49IPbTxRu66JZc3LjJqiaC" 'False) (C1 ('MetaCons "Location" 'PrefixI 'True) (S1 ('MetaSel ('Just "_uri") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Uri) :*: S1 ('MetaSel ('Just "_range") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Range))) |
Instances
Position | |
|
Instances
fromNormalizedUri :: NormalizedUri -> Uri #
toNormalizedUri :: Uri -> NormalizedUri #
Instances
data NormalizedFilePath #
Newtype wrapper around FilePath that always has normalized slashes. The NormalizedUri and hash of the FilePath are cached to avoided repeated normalisation when we need to compute them (which is a lot).
This is one of the most performance critical parts of ghcide, do not modify it without profiling.
Instances
All LSP types representing a list **must** use this type rather than '[]'.
In particular this is necessary to change the FromJSON
instance to be compatible
with Elisp (where empty lists show up as null
)
List [a] |
Instances
action :: Partial => Action a -> Rules () #
Run an action, usually used for specifying top-level requirements.
main =shake
shakeOptions
$ doaction
$ do b <-doesFileExist
"file.src" when b $need
["file.out"]
This action
builds file.out
, but only if file.src
exists. The action
will be run in every build execution (unless withoutActions
is used), so only cheap
operations should be performed. On the flip side, consulting system information
(e.g. environment variables) can be done directly as the information will not be cached.
All calls to action
may be run in parallel, in any order.
For the standard requirement of only need
ing a fixed list of files in the action
,
see want
.
Define a set of rules. Rules can be created with calls to functions such as %>
or action
.
Rules are combined with either the Monoid
instance, or (more commonly) the Monad
instance and do
notation.
To define your own custom types of rule, see Development.Shake.Rule.
Instances
Monad Rules | |
Functor Rules | |
MonadFix Rules | |
Defined in Development.Shake.Internal.Core.Rules | |
MonadFail Rules | |
Defined in Development.Shake.Internal.Core.Rules | |
Applicative Rules | |
MonadIO Rules | |
Defined in Development.Shake.Internal.Core.Rules | |
Semigroup a => Semigroup (Rules a) | |
(Semigroup a, Monoid a) => Monoid (Rules a) | |
type family RuleResult key #
The type mapping between the key
or a rule and the resulting value
.
See addBuiltinRule
and apply
.
Instances
type RuleResult FileQ | |
Defined in Development.Shake.Internal.Rules.File type RuleResult FileQ = FileR | |
type RuleResult DoesDirectoryExistQ | |
Defined in Development.Shake.Internal.Rules.Directory type RuleResult DoesDirectoryExistQ = DoesDirectoryExistA | |
type RuleResult DoesFileExistQ | |
Defined in Development.Shake.Internal.Rules.Directory type RuleResult DoesFileExistQ = DoesFileExistA | |
type RuleResult GetDirectoryContentsQ | |
Defined in Development.Shake.Internal.Rules.Directory type RuleResult GetDirectoryContentsQ = GetDirectoryA | |
type RuleResult GetDirectoryDirsQ | |
Defined in Development.Shake.Internal.Rules.Directory type RuleResult GetDirectoryDirsQ = GetDirectoryA | |
type RuleResult GetDirectoryFilesQ | |
Defined in Development.Shake.Internal.Rules.Directory type RuleResult GetDirectoryFilesQ = GetDirectoryA | |
type RuleResult GetEnvQ | |
Defined in Development.Shake.Internal.Rules.Directory type RuleResult GetEnvQ = GetEnvA | |
type RuleResult FilesQ | |
Defined in Development.Shake.Internal.Rules.Files type RuleResult FilesQ = FilesA | |
type RuleResult AlwaysRerunQ | |
Defined in Development.Shake.Internal.Rules.Rerun type RuleResult AlwaysRerunQ = () | |
type RuleResult GhcSessionIO Source # | |
Defined in Development.IDE.Core.RuleTypes | |
type RuleResult GetClientSettings Source # | |
Defined in Development.IDE.Core.RuleTypes | |
type RuleResult GetModSummary Source # | Generate a ModSummary that has enough information to be used to get .hi and .hie files. without needing to parse the entire source |
Defined in Development.IDE.Core.RuleTypes | |
type RuleResult GetModSummaryWithoutTimestamps Source # | Generate a ModSummary with the timestamps elided, for more successful early cutoff |
Defined in Development.IDE.Core.RuleTypes | |
type RuleResult IsFileOfInterest Source # | |
Defined in Development.IDE.Core.RuleTypes | |
type RuleResult GetModIfaceWithoutLinkable Source # | Get a module interface details, without the Linkable For better early cuttoff |
Defined in Development.IDE.Core.RuleTypes | |
type RuleResult GetModIface Source # | Get a module interface details, either from an interface file or a typechecked module |
Defined in Development.IDE.Core.RuleTypes | |
type RuleResult GetModIfaceFromDiskAndIndex Source # | GetModIfaceFromDisk and index the `.hie` file into the database.
This is an internal rule, use |
Defined in Development.IDE.Core.RuleTypes | |
type RuleResult GetModIfaceFromDisk Source # | Read the module interface file from disk. Throws an error for VFS files.
This is an internal rule, use |
Defined in Development.IDE.Core.RuleTypes | |
type RuleResult GhcSessionDeps Source # | A GHC session preloaded with all the dependencies |
Defined in Development.IDE.Core.RuleTypes | |
type RuleResult GhcSession Source # | A GHC session that we reuse. |
Defined in Development.IDE.Core.RuleTypes | |
type RuleResult GetBindings Source # | A IntervalMap telling us what is in scope at each point |
Defined in Development.IDE.Core.RuleTypes | |
type RuleResult GetHieAst Source # | The uncompressed HieAST |
Defined in Development.IDE.Core.RuleTypes | |
type RuleResult GetDocMap Source # | |
Defined in Development.IDE.Core.RuleTypes | |
type RuleResult TypeCheck Source # | The type checked version of this file, requires TypeCheck+ |
Defined in Development.IDE.Core.RuleTypes | |
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. |
Defined in Development.IDE.Core.RuleTypes | |
type RuleResult ReportImportCycles Source # | This rule is used to report import cycles. It depends on GetDependencyInformation. We cannot report the cycles directly from GetDependencyInformation since we can only report diagnostics for the current file. |
Defined in Development.IDE.Core.RuleTypes | |
type RuleResult GetModuleGraph Source # | |
Defined in Development.IDE.Core.RuleTypes | |
type RuleResult GetDependencyInformation Source # | The dependency information produced by following the imports recursively. This rule will succeed even if there is an error, e.g., a module could not be located, a module could not be parsed or an import cycle. |
type RuleResult NeedsCompilation Source # | Does this module need to be compiled? |
Defined in Development.IDE.Core.RuleTypes | |
type RuleResult GetLocatedImports Source # | Resolve the imports in a module to the file path of a module in the same package |
Defined in Development.IDE.Core.RuleTypes | |
type RuleResult GetParsedModuleWithComments Source # | The parse tree for the file using GetFileContents, all comments included using Opt_KeepRawTokenStream |
Defined in Development.IDE.Core.RuleTypes | |
type RuleResult GetParsedModule Source # | The parse tree for the file using GetFileContents |
Defined in Development.IDE.Core.RuleTypes | |
type RuleResult GetFileContents Source # | Get the contents of a file, either dirty (if the buffer is modified) or Nothing to mean use from disk. |
Defined in Development.IDE.Core.RuleTypes | |
type RuleResult GetModificationTime Source # | Get the modification time of a file. |
Defined in Development.IDE.Core.RuleTypes | |
type RuleResult GetImportMap Source # | |
Defined in Development.IDE.Core.RuleTypes | |
type RuleResult GenerateCore Source # | Convert to Core, requires TypeCheck* |
Defined in Development.IDE.Core.RuleTypes | |
type RuleResult GetKnownTargets Source # | |
Defined in Development.IDE.Core.RuleTypes | |
type RuleResult GetAnnotatedParsedSource Source # | |
Defined in Development.IDE.GHC.ExactPrint | |
type RuleResult NonLocalCompletions Source # | |
Defined in Development.IDE.Plugin.Completions | |
type RuleResult LocalCompletions Source # | Produce completions info for a file |
Defined in Development.IDE.Plugin.Completions | |
type RuleResult IsHiFileStable Source # | |
Defined in Development.IDE.Core.Rules | |
type RuleResult (OracleQ a) | |
Defined in Development.Shake.Internal.Rules.Oracle | |
type RuleResult (Q k) Source # | |
Defined in Development.IDE.Types.Shake |
The Action
monad, use liftIO
to raise IO
actions into it, and need
to execute files.
Action values are used by addUserRule
and action
. The Action
monad tracks the dependencies of a rule.
To raise an exception call error
, fail
or
.liftIO
. throwIO
Instances
Monad Action | |
Functor Action | |
MonadFail Action | |
Defined in Development.Shake.Internal.Core.Types | |
Applicative Action | |
MonadIO Action | |
Defined in Development.Shake.Internal.Core.Types | |
MonadTempDir Action | |
Defined in Development.Shake.Command runWithTempDir :: (FilePath -> Action a) -> Action a runWithTempFile :: (FilePath -> Action a) -> Action a | |
Semigroup a => Semigroup (Action a) | |
Monoid a => Monoid (Action a) | |
CmdResult r => CmdArguments (Action r) | |
Defined in Development.Shake.Command cmdArguments :: CmdArgument -> Action r # |
dontWriteHieFiles :: DynFlags -> DynFlags Source #
uriToFilePath' :: Uri -> Maybe FilePath Source #
We use an empty string as a filepath when we don’t have a file. However, haskell-lsp doesn’t support that in uriToFilePath and given that it is not a valid filepath it does not make sense to upstream a fix. So we have our own wrapper here that supports empty filepaths.
showPosition :: Position -> String Source #
readSrcSpan :: ReadS RealSrcSpan Source #
Parser for the GHC output format
type FileDiagnostic = (NormalizedFilePath, ShowDiagnostic, Diagnostic) Source #
Human readable diagnostics for a specific file.
This type packages a pretty printed, human readable error message along with the related source location so that we can display the error on either the console or in the IDE at the right source location.
data ShowDiagnostic Source #
Defines whether a particular diagnostic should be reported back to the user.
One important use case is "missing signature" code lenses, for which we need to enable the corresponding warning during type checking. However, we do not want to show the warning unless the programmer asks for it (#261).
Instances
Eq ShowDiagnostic Source # | |
Defined in Development.IDE.Types.Diagnostics (==) :: ShowDiagnostic -> ShowDiagnostic -> Bool # (/=) :: ShowDiagnostic -> ShowDiagnostic -> Bool # | |
Ord ShowDiagnostic Source # | |
Defined in Development.IDE.Types.Diagnostics compare :: ShowDiagnostic -> ShowDiagnostic -> Ordering # (<) :: ShowDiagnostic -> ShowDiagnostic -> Bool # (<=) :: ShowDiagnostic -> ShowDiagnostic -> Bool # (>) :: ShowDiagnostic -> ShowDiagnostic -> Bool # (>=) :: ShowDiagnostic -> ShowDiagnostic -> Bool # max :: ShowDiagnostic -> ShowDiagnostic -> ShowDiagnostic # min :: ShowDiagnostic -> ShowDiagnostic -> ShowDiagnostic # | |
Show ShowDiagnostic Source # | |
Defined in Development.IDE.Types.Diagnostics showsPrec :: Int -> ShowDiagnostic -> ShowS # show :: ShowDiagnostic -> String # showList :: [ShowDiagnostic] -> ShowS # | |
NFData ShowDiagnostic Source # | |
Defined in Development.IDE.Types.Diagnostics rnf :: ShowDiagnostic -> () # |
type IdeResult v = ([FileDiagnostic], Maybe v) Source #
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.
ideErrorText :: NormalizedFilePath -> Text -> FileDiagnostic Source #
ideErrorWithSource :: Maybe DiagnosticSource -> Maybe DiagnosticSeverity -> a -> Text -> (a, ShowDiagnostic, Diagnostic) Source #
showDiagnostics :: [FileDiagnostic] -> Text Source #
showDiagnosticsColored :: [FileDiagnostic] -> Text Source #
modifyDynFlags :: GhcMonad m => (DynFlags -> DynFlags) -> m () Source #
Used to modify dyn flags in preference to calling setSessionDynFlags
,
since that function also reloads packages (which is very slow).
lookupPackageConfig :: UnitId -> HscEnv -> Maybe PackageConfig Source #
Given a UnitId
try and find the associated PackageConfig
in the environment.
textToStringBuffer :: Text -> StringBuffer Source #
Convert from the text
package to the GHC
StringBuffer
.
Currently implemented somewhat inefficiently (if it ever comes up in a profile).
prettyPrint :: Outputable a => a -> String Source #
Pretty print a GHC value using 'unsafeGlobalDynFlags '.
unsafePrintSDoc :: SDoc -> String Source #
moduleImportPath :: NormalizedFilePath -> ModuleName -> Maybe FilePath Source #
Given a module location, and its parse tree, figure out what is the include directory implied by it.
For example, given the file /usr/Test/Foo/Bar.hs
with the module name Foo.Bar
the directory
/usr/Test
should be on the include path to find sibling modules.
readFileUtf8 :: FilePath -> IO Text Source #
Read a UTF8 file, with lenient decoding, so it will never raise a decoding error.
cgGutsToCoreModule :: SafeHaskellMode -> CgGuts -> ModDetails -> CoreModule Source #
Convert from a CgGuts
to a CoreModule
.
fingerprintToBS :: Fingerprint -> ByteString Source #
Convert a Fingerprint
to a ByteString
by copying the byte across.
Will produce an 8 byte unreadable ByteString.
fingerprintFromStringBuffer :: StringBuffer -> IO Fingerprint Source #
Take the Fingerprint
of a StringBuffer
.
hDuplicateTo' :: Handle -> Handle -> IO () Source #
A slightly modified version of hDuplicateTo
from GHC.
Importantly, it avoids the bug listed in https://gitlab.haskell.org/ghc/ghc/merge_requests/2318.
diagFromErrMsg :: Text -> DynFlags -> ErrMsg -> [FileDiagnostic] Source #
Produce a GHC-style error from a source span and a message.
diagFromErrMsgs :: Text -> DynFlags -> Bag ErrMsg -> [FileDiagnostic] Source #
srcSpanToFilename :: SrcSpan -> Maybe FilePath Source #
Extract a file name from a GHC SrcSpan (use message for unhelpful ones) FIXME This may not be an _absolute_ file name, needs fixing.
rangeToSrcSpan :: NormalizedFilePath -> Range -> SrcSpan Source #
toDSeverity :: Severity -> Maybe DiagnosticSeverity Source #
Convert a GHC severity to a DAML compiler Severity. Severities below Warning level are dropped (returning Nothing).
diagFromStrings :: Text -> DiagnosticSeverity -> [(SrcSpan, String)] -> [FileDiagnostic] Source #
Produce a bag of GHC-style errors (ErrorMessages
) from the given
(optional) locations and message strings.
diagFromString :: Text -> DiagnosticSeverity -> SrcSpan -> String -> [FileDiagnostic] Source #
Produce a GHC-style error from a source span and a message.
:: FastString | file path of span |
-> RealSrcSpan |
creates a span with zero length in the filename of the argument passed
catchSrcErrors :: DynFlags -> Text -> IO a -> IO (Either [FileDiagnostic] a) Source #
Catch the errors thrown by GHC (SourceErrors and compiler-internal exceptions like Panic or InstallationError), and turn them into diagnostics
diagFromGhcException :: Text -> DynFlags -> GhcException -> [FileDiagnostic] Source #
An HscEnv
with equality. Two values are considered equal
if they are created with the same call to newHscEnvEq
.
hscEnvWithImportPaths :: HscEnvEq -> HscEnv Source #
Unwrap the HscEnv
with the original import paths.
Used only for locating imports
Note that this is logging actions _of the program_, not of the user. You shouldn't call warning/error if the user has caused an error, only if our code has gone wrong and is itself erroneous (e.g. we threw an exception).
Logger | |
|
Telemetry | Events that are useful for gathering user metrics. |
Debug | Verbose debug logging. |
Info | Useful information in case an error has to be understood. |
Warning | These error messages should not occur in a expected usage, and should be investigated. |
Error | Such log messages must never occur in expected usage. |
Instances
Bounded Priority Source # | |
Enum Priority Source # | |
Defined in Development.IDE.Types.Logger | |
Eq Priority Source # | |
Ord Priority Source # | |
Defined in Development.IDE.Types.Logger | |
Show Priority Source # | |
data GhcSessionIO Source #
Instances
Eq GhcSessionIO Source # | |
Defined in Development.IDE.Core.RuleTypes (==) :: GhcSessionIO -> GhcSessionIO -> Bool # (/=) :: GhcSessionIO -> GhcSessionIO -> Bool # | |
Show GhcSessionIO Source # | |
Defined in Development.IDE.Core.RuleTypes showsPrec :: Int -> GhcSessionIO -> ShowS # show :: GhcSessionIO -> String # showList :: [GhcSessionIO] -> ShowS # | |
Generic GhcSessionIO Source # | |
Defined in Development.IDE.Core.RuleTypes type Rep GhcSessionIO :: Type -> Type # from :: GhcSessionIO -> Rep GhcSessionIO x # to :: Rep GhcSessionIO x -> GhcSessionIO # | |
Hashable GhcSessionIO Source # | |
Defined in Development.IDE.Core.RuleTypes hashWithSalt :: Int -> GhcSessionIO -> Int # hash :: GhcSessionIO -> Int # | |
Binary GhcSessionIO Source # | |
Defined in Development.IDE.Core.RuleTypes | |
NFData GhcSessionIO Source # | |
Defined in Development.IDE.Core.RuleTypes rnf :: GhcSessionIO -> () # | |
type Rep GhcSessionIO Source # | |
type RuleResult GhcSessionIO Source # | |
Defined in Development.IDE.Core.RuleTypes |
data GetClientSettings Source #
Get the vscode client settings stored in the ide state
Instances
data GetModSummary Source #
Instances
data GetModSummaryWithoutTimestamps Source #
Instances
Eq GetModSummaryWithoutTimestamps Source # | |
Show GetModSummaryWithoutTimestamps Source # | |
Defined in Development.IDE.Core.RuleTypes | |
Generic GetModSummaryWithoutTimestamps Source # | |
Defined in Development.IDE.Core.RuleTypes type Rep GetModSummaryWithoutTimestamps :: Type -> Type # | |
Hashable GetModSummaryWithoutTimestamps Source # | |
Defined in Development.IDE.Core.RuleTypes hashWithSalt :: Int -> GetModSummaryWithoutTimestamps -> Int # | |
Binary GetModSummaryWithoutTimestamps Source # | |
Defined in Development.IDE.Core.RuleTypes | |
NFData GetModSummaryWithoutTimestamps Source # | |
Defined in Development.IDE.Core.RuleTypes rnf :: GetModSummaryWithoutTimestamps -> () # | |
type Rep GetModSummaryWithoutTimestamps Source # | |
type RuleResult GetModSummaryWithoutTimestamps Source # | Generate a ModSummary with the timestamps elided, for more successful early cutoff |
Defined in Development.IDE.Core.RuleTypes |
data IsFileOfInterest Source #
Instances
data GetModIfaceWithoutLinkable Source #
Instances
data GetModIface Source #
Instances
data GetModIfaceFromDiskAndIndex Source #
Instances
data GetModIfaceFromDisk Source #
Instances
data GhcSessionDeps Source #
Instances
data GhcSession Source #
Instances
Eq GhcSession Source # | |
Defined in Development.IDE.Core.RuleTypes (==) :: GhcSession -> GhcSession -> Bool # (/=) :: GhcSession -> GhcSession -> Bool # | |
Show GhcSession Source # | |
Defined in Development.IDE.Core.RuleTypes showsPrec :: Int -> GhcSession -> ShowS # show :: GhcSession -> String # showList :: [GhcSession] -> ShowS # | |
Generic GhcSession Source # | |
Defined in Development.IDE.Core.RuleTypes type Rep GhcSession :: Type -> Type # from :: GhcSession -> Rep GhcSession x # to :: Rep GhcSession x -> GhcSession # | |
Hashable GhcSession Source # | |
Defined in Development.IDE.Core.RuleTypes hashWithSalt :: Int -> GhcSession -> Int # hash :: GhcSession -> Int # | |
Binary GhcSession Source # | |
Defined in Development.IDE.Core.RuleTypes | |
NFData GhcSession Source # | |
Defined in Development.IDE.Core.RuleTypes rnf :: GhcSession -> () # | |
type Rep GhcSession Source # | |
type RuleResult GhcSession Source # | A GHC session that we reuse. |
Defined in Development.IDE.Core.RuleTypes |
data GetBindings Source #
Instances
Eq GetBindings Source # | |
Defined in Development.IDE.Core.RuleTypes (==) :: GetBindings -> GetBindings -> Bool # (/=) :: GetBindings -> GetBindings -> Bool # | |
Show GetBindings Source # | |
Defined in Development.IDE.Core.RuleTypes showsPrec :: Int -> GetBindings -> ShowS # show :: GetBindings -> String # showList :: [GetBindings] -> ShowS # | |
Generic GetBindings Source # | |
Defined in Development.IDE.Core.RuleTypes type Rep GetBindings :: Type -> Type # from :: GetBindings -> Rep GetBindings x # to :: Rep GetBindings x -> GetBindings # | |
Hashable GetBindings Source # | |
Defined in Development.IDE.Core.RuleTypes hashWithSalt :: Int -> GetBindings -> Int # hash :: GetBindings -> Int # | |
Binary GetBindings Source # | |
Defined in Development.IDE.Core.RuleTypes | |
NFData GetBindings Source # | |
Defined in Development.IDE.Core.RuleTypes rnf :: GetBindings -> () # | |
type Rep GetBindings Source # | |
type RuleResult GetBindings Source # | A IntervalMap telling us what is in scope at each point |
Defined in Development.IDE.Core.RuleTypes |
Instances
Eq GetHieAst Source # | |
Show GetHieAst Source # | |
Generic GetHieAst Source # | |
Hashable GetHieAst Source # | |
Defined in Development.IDE.Core.RuleTypes | |
Binary GetHieAst Source # | |
NFData GetHieAst Source # | |
Defined in Development.IDE.Core.RuleTypes | |
type Rep GetHieAst Source # | |
type RuleResult GetHieAst Source # | The uncompressed HieAST |
Defined in Development.IDE.Core.RuleTypes |
Instances
Eq GetDocMap Source # | |
Show GetDocMap Source # | |
Generic GetDocMap Source # | |
Hashable GetDocMap Source # | |
Defined in Development.IDE.Core.RuleTypes | |
Binary GetDocMap Source # | |
NFData GetDocMap Source # | |
Defined in Development.IDE.Core.RuleTypes | |
type Rep GetDocMap Source # | |
type RuleResult GetDocMap Source # | |
Defined in Development.IDE.Core.RuleTypes |
Instances
Eq TypeCheck Source # | |
Show TypeCheck Source # | |
Generic TypeCheck Source # | |
Hashable TypeCheck Source # | |
Defined in Development.IDE.Core.RuleTypes | |
Binary TypeCheck Source # | |
NFData TypeCheck Source # | |
Defined in Development.IDE.Core.RuleTypes | |
type Rep TypeCheck Source # | |
type RuleResult TypeCheck Source # | The type checked version of this file, requires TypeCheck+ |
Defined in Development.IDE.Core.RuleTypes |
data GetDependencies Source #
Instances
data ReportImportCycles Source #
Instances
data GetModuleGraph Source #
Instances
data GetDependencyInformation Source #
Instances
data NeedsCompilation Source #
Instances
data GetLocatedImports Source #
Instances
data GetParsedModuleWithComments Source #
Instances
data GetParsedModule Source #
Instances
data IsFileOfInterestResult Source #
Instances
data FileOfInterestStatus Source #
Instances
data GetFileContents Source #
Instances
data FileVersion Source #
Instances
data GetModificationTime Source #
GetModificationTime_ | |
|
Instances
data DocAndKindMap Source #
DKMap | |
|
Instances
Show DocAndKindMap Source # | |
Defined in Development.IDE.Core.RuleTypes showsPrec :: Int -> DocAndKindMap -> ShowS # show :: DocAndKindMap -> String # showList :: [DocAndKindMap] -> ShowS # | |
NFData DocAndKindMap Source # | |
Defined in Development.IDE.Core.RuleTypes rnf :: DocAndKindMap -> () # |
data HieAstResult Source #
Save the uncompressed AST here, we compress it just before writing to disk
forall a. HAR | |
Instances
Show HieAstResult Source # | |
Defined in Development.IDE.Core.RuleTypes showsPrec :: Int -> HieAstResult -> ShowS # show :: HieAstResult -> String # showList :: [HieAstResult] -> ShowS # | |
NFData HieAstResult Source # | |
Defined in Development.IDE.Core.RuleTypes rnf :: HieAstResult -> () # |
data HiFileResult Source #
HiFileResult | |
|
Instances
Show HiFileResult Source # | |
Defined in Development.IDE.Core.RuleTypes showsPrec :: Int -> HiFileResult -> ShowS # show :: HiFileResult -> String # showList :: [HiFileResult] -> ShowS # | |
NFData HiFileResult Source # | |
Defined in Development.IDE.Core.RuleTypes rnf :: HiFileResult -> () # |
data TcModuleResult Source #
Contains the typechecked module and the OrigNameCache entry for that module.
TcModuleResult | |
|
Instances
Show TcModuleResult Source # | |
Defined in Development.IDE.Core.RuleTypes showsPrec :: Int -> TcModuleResult -> ShowS # show :: TcModuleResult -> String # showList :: [TcModuleResult] -> ShowS # | |
NFData TcModuleResult Source # | |
Defined in Development.IDE.Core.RuleTypes rnf :: TcModuleResult -> () # |
Splices | |
|
ImportMap | |
|
data GetImportMap Source #
Instances
Eq GetImportMap Source # | |
Defined in Development.IDE.Core.RuleTypes (==) :: GetImportMap -> GetImportMap -> Bool # (/=) :: GetImportMap -> GetImportMap -> Bool # | |
Show GetImportMap Source # | |
Defined in Development.IDE.Core.RuleTypes showsPrec :: Int -> GetImportMap -> ShowS # show :: GetImportMap -> String # showList :: [GetImportMap] -> ShowS # | |
Generic GetImportMap Source # | |
Defined in Development.IDE.Core.RuleTypes type Rep GetImportMap :: Type -> Type # from :: GetImportMap -> Rep GetImportMap x # to :: Rep GetImportMap x -> GetImportMap # | |
Hashable GetImportMap Source # | |
Defined in Development.IDE.Core.RuleTypes hashWithSalt :: Int -> GetImportMap -> Int # hash :: GetImportMap -> Int # | |
Binary GetImportMap Source # | |
Defined in Development.IDE.Core.RuleTypes | |
NFData GetImportMap Source # | |
Defined in Development.IDE.Core.RuleTypes rnf :: GetImportMap -> () # | |
type Rep GetImportMap Source # | |
type RuleResult GetImportMap Source # | |
Defined in Development.IDE.Core.RuleTypes |
data GenerateCore Source #
Instances
data GetKnownTargets Source #
Instances
data LinkableType Source #
Instances
Eq LinkableType Source # | |
Defined in Development.IDE.Core.RuleTypes (==) :: LinkableType -> LinkableType -> Bool # (/=) :: LinkableType -> LinkableType -> Bool # | |
Ord LinkableType Source # | |
Defined in Development.IDE.Core.RuleTypes compare :: LinkableType -> LinkableType -> Ordering # (<) :: LinkableType -> LinkableType -> Bool # (<=) :: LinkableType -> LinkableType -> Bool # (>) :: LinkableType -> LinkableType -> Bool # (>=) :: LinkableType -> LinkableType -> Bool # max :: LinkableType -> LinkableType -> LinkableType # min :: LinkableType -> LinkableType -> LinkableType # | |
Show LinkableType Source # | |
Defined in Development.IDE.Core.RuleTypes showsPrec :: Int -> LinkableType -> ShowS # show :: LinkableType -> String # showList :: [LinkableType] -> ShowS # |
pattern GetModificationTime :: GetModificationTime Source #
hirModIface :: HiFileResult -> ModIface Source #
vfsVersion :: FileVersion -> Maybe Int Source #
awSplicesL :: Lens' Splices [(LHsExpr GhcTc, Serialized)] Source #
Instances
Monad IdeAction Source # | |
Functor IdeAction Source # | |
Applicative IdeAction Source # | |
MonadIO IdeAction Source # | |
Defined in Development.IDE.Core.Shake | |
MonadReader ShakeExtras IdeAction Source # | |
Defined in Development.IDE.Core.Shake ask :: IdeAction ShakeExtras # local :: (ShakeExtras -> ShakeExtras) -> IdeAction a -> IdeAction a # reader :: (ShakeExtras -> a) -> IdeAction a # |
A Shake database plus persistent store. Can be thought of as storing
mappings from (FilePath, k)
to RuleResult k
.
type IdeRule k v = (RuleResult k ~ v, ShakeValue k, Show v, Typeable v, NFData v) Source #
data ShakeExtras Source #
Instances
MonadReader ShakeExtras IdeAction Source # | |
Defined in Development.IDE.Core.Shake ask :: IdeAction ShakeExtras # local :: (ShakeExtras -> ShakeExtras) -> IdeAction a -> IdeAction a # reader :: (ShakeExtras -> a) -> IdeAction a # |
define :: IdeRule k v => (k -> NormalizedFilePath -> Action (IdeResult v)) -> Rules () Source #
Define a new Rule without early cutoff
use :: IdeRule k v => k -> NormalizedFilePath -> Action (Maybe v) Source #
Request a Rule result if available
useWithStale :: IdeRule k v => k -> NormalizedFilePath -> Action (Maybe (v, PositionMapping)) Source #
Request a Rule result, it not available return the last computed result, if any, which may be stale
useWithStale_ :: IdeRule k v => k -> NormalizedFilePath -> Action (v, PositionMapping) Source #
Request a Rule result, it not available return the last computed result which may be stale. Errors out if none available.
runIdeAction :: String -> ShakeExtras -> IdeAction a -> IO a Source #
IdeActions are used when we want to return a result immediately, even if it is stale Useful for UI actions like hover, completion where we don't want to block.
useWithStaleFast :: IdeRule k v => k -> NormalizedFilePath -> IdeAction (Maybe (v, PositionMapping)) Source #
Lookup value in the database and return with the stale value immediately Will queue an action to refresh the value. Might block the first time the rule runs, but never blocks after that.
useWithStaleFast' :: IdeRule k v => k -> NormalizedFilePath -> IdeAction (FastResult v) Source #
Same as useWithStaleFast but lets you wait for an up to date result
useNoFile_ :: IdeRule k v => k -> Action v Source #
defineEarlyCutoff :: IdeRule k v => (k -> NormalizedFilePath -> Action (Maybe ByteString, IdeResult v)) -> Rules () Source #
Define a new Rule with early cutoff
Plugin | |
|
getFilesOfInterest :: Action (HashMap NormalizedFilePath FileOfInterestStatus) Source #
Get the files that are open in the IDE.
data IdeConfiguration Source #
Lsp client relevant configuration details
Instances
Show IdeConfiguration Source # | |
Defined in Development.IDE.Core.IdeConfiguration showsPrec :: Int -> IdeConfiguration -> ShowS # show :: IdeConfiguration -> String # showList :: [IdeConfiguration] -> ShowS # |
getFileContents :: NormalizedFilePath -> Action (UTCTime, Maybe Text) Source #
Returns the modification time and the contents. For VFS paths, the modification time is the current time.
getFileExists :: NormalizedFilePath -> Action Bool Source #
Returns True if the file exists
Note that a file is not considered to exist unless it is saved to disk.
In particular, VFS existence is not enough.
Consider the following example:
1. The file A.hs
containing the line import B
is added to the files of interest
Since B.hs
is neither open nor exists, GetLocatedImports finds Nothing
2. The editor creates a new buffer B.hs
Unless the editor also sends a DidChangeWatchedFile
event, ghcide will not pick it up
Most editors, e.g. VSCode, only send the event when the file is saved to disk.
getAtPoint :: NormalizedFilePath -> Position -> IdeAction (Maybe (Maybe Range, [Text])) Source #
Try to get hover text for the name under point.
getDefinition :: NormalizedFilePath -> Position -> IdeAction (Maybe [Location]) Source #
Goto Definition.
getTypeDefinition :: NormalizedFilePath -> Position -> IdeAction (Maybe [Location]) Source #
getParsedModule :: NormalizedFilePath -> Action (Maybe ParsedModule) Source #
Parse the contents of a haskell file.