Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- (<>) :: Semigroup a => a -> a -> a
- data ParseResult a
- action :: Action a -> Rules ()
- type family RuleResult key
- data Rules a
- data Action a
- getClientConfig :: MonadLsp Config m => m Config
- data NormalizedUri
- type DiagnosticStore = HashMap NormalizedUri StoreItem
- data Diagnostic = Diagnostic {}
- data DiagnosticSeverity
- data Location = Location {}
- data Range = Range {}
- data Position = Position {
- _line :: UInt
- _character :: UInt
- fromNormalizedFilePath :: NormalizedFilePath -> FilePath
- fromNormalizedUri :: NormalizedUri -> Uri
- toNormalizedUri :: Uri -> NormalizedUri
- newtype Uri = Uri {}
- data NormalizedFilePath
- newtype List a = List [a]
- renderStrict :: SimpleDocStream ann -> Text
- pipe :: Doc ann
- equals :: Doc ann
- backslash :: Doc ann
- slash :: Doc ann
- dot :: Doc ann
- space :: Doc ann
- comma :: Doc ann
- colon :: Doc ann
- semi :: Doc ann
- rbrace :: Doc ann
- lbrace :: Doc ann
- rbracket :: Doc ann
- lbracket :: Doc ann
- rangle :: Doc ann
- langle :: Doc ann
- rparen :: Doc ann
- lparen :: Doc ann
- dquote :: Doc ann
- squote :: Doc ann
- braces :: Doc ann -> Doc ann
- brackets :: Doc ann -> Doc ann
- angles :: Doc ann -> Doc ann
- parens :: Doc ann -> Doc ann
- dquotes :: Doc ann -> Doc ann
- squotes :: Doc ann -> Doc ann
- layoutCompact :: Doc ann1 -> SimpleDocStream ann2
- layoutSmart :: LayoutOptions -> Doc ann -> SimpleDocStream ann
- layoutPretty :: LayoutOptions -> Doc ann -> SimpleDocStream ann
- defaultLayoutOptions :: LayoutOptions
- removeTrailingWhitespace :: SimpleDocStream ann -> SimpleDocStream ann
- fuse :: FusionDepth -> Doc ann -> Doc ann
- alterAnnotationsS :: (ann -> Maybe ann') -> SimpleDocStream ann -> SimpleDocStream ann'
- reAnnotateS :: (ann -> ann') -> SimpleDocStream ann -> SimpleDocStream ann'
- unAnnotateS :: SimpleDocStream ann -> SimpleDocStream xxx
- alterAnnotations :: (ann -> [ann']) -> Doc ann -> Doc ann'
- reAnnotate :: (ann -> ann') -> Doc ann -> Doc ann'
- unAnnotate :: Doc ann -> Doc xxx
- annotate :: ann -> Doc ann -> Doc ann
- surround :: Doc ann -> Doc ann -> Doc ann -> Doc ann
- enclose :: Doc ann -> Doc ann -> Doc ann -> Doc ann
- plural :: (Num amount, Eq amount) => doc -> doc -> amount -> doc
- fillBreak :: Int -> Doc ann -> Doc ann
- fill :: Int -> Doc ann -> Doc ann
- pageWidth :: (PageWidth -> Doc ann) -> Doc ann
- width :: Doc ann -> (Int -> Doc ann) -> Doc ann
- nesting :: (Int -> Doc ann) -> Doc ann
- column :: (Int -> Doc ann) -> Doc ann
- punctuate :: Doc ann -> [Doc ann] -> [Doc ann]
- cat :: [Doc ann] -> Doc ann
- fillCat :: [Doc ann] -> Doc ann
- vcat :: [Doc ann] -> Doc ann
- hcat :: [Doc ann] -> Doc ann
- sep :: [Doc ann] -> Doc ann
- fillSep :: [Doc ann] -> Doc ann
- vsep :: [Doc ann] -> Doc ann
- hsep :: [Doc ann] -> Doc ann
- concatWith :: Foldable t => (Doc ann -> Doc ann -> Doc ann) -> t (Doc ann) -> Doc ann
- (<+>) :: Doc ann -> Doc ann -> Doc ann
- tupled :: [Doc ann] -> Doc ann
- list :: [Doc ann] -> Doc ann
- encloseSep :: Doc ann -> Doc ann -> Doc ann -> [Doc ann] -> Doc ann
- indent :: Int -> Doc ann -> Doc ann
- hang :: Int -> Doc ann -> Doc ann
- align :: Doc ann -> Doc ann
- flatAlt :: Doc ann -> Doc ann -> Doc ann
- group :: Doc ann -> Doc ann
- hardline :: Doc ann
- softline' :: Doc ann
- softline :: Doc ann
- line' :: Doc ann
- line :: Doc ann
- nest :: Int -> Doc ann -> Doc ann
- emptyDoc :: Doc ann
- unsafeViaShow :: Show a => a -> Doc ann
- viaShow :: Show a => a -> Doc ann
- data Doc ann
- class Pretty a where
- pretty :: a -> Doc ann
- prettyList :: [a] -> Doc ann
- data FusionDepth
- data SimpleDocStream ann
- = SFail
- | SEmpty
- | SChar !Char (SimpleDocStream ann)
- | SText !Int !Text (SimpleDocStream ann)
- | SLine !Int (SimpleDocStream ann)
- | SAnnPush ann (SimpleDocStream ann)
- | SAnnPop (SimpleDocStream ann)
- data PageWidth
- newtype LayoutOptions = LayoutOptions {}
- data GhcVersion
- setHieDir :: FilePath -> DynFlags -> DynFlags
- dontWriteHieFiles :: DynFlags -> DynFlags
- disableWarningsAsErrors :: DynFlags -> DynFlags
- ghcVersion :: GhcVersion
- 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 IdeResultNoDiagnosticsEarlyCutoff v = (Maybe ByteString, Maybe v)
- 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 :: Unit -> HscEnv -> Maybe UnitInfo
- textToStringBuffer :: Text -> StringBuffer
- runParser :: DynFlags -> String -> P a -> ParseResult a
- stringBufferToByteString :: StringBuffer -> ByteString
- bytestringToStringBuffer :: ByteString -> StringBuffer
- 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
- fingerprintFromByteString :: ByteString -> IO Fingerprint
- fingerprintFromPut :: Put -> IO Fingerprint
- hDuplicateTo' :: Handle -> Handle -> IO ()
- traceAst :: (Data a, ExactPrint a, Outputable a, HasCallStack) => String -> a -> a
- printOutputable :: Outputable a => a -> Text
- diagFromErrMsg :: Text -> DynFlags -> MsgEnvelope DecoratedSDoc -> [FileDiagnostic]
- diagFromErrMsgs :: Text -> DynFlags -> Bag (MsgEnvelope DecoratedSDoc) -> [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 GhcSessionIO = GhcSessionIO
- data IdeGhcSession = IdeGhcSession {
- loadSessionFun :: FilePath -> IO (IdeResult HscEnvEq, [FilePath])
- sessionVersion :: !Int
- data AddWatchedFile = AddWatchedFile
- data GetClientSettings = GetClientSettings
- data GetModSummary = GetModSummary
- data GetModSummaryWithoutTimestamps = GetModSummaryWithoutTimestamps
- data IsFileOfInterest = IsFileOfInterest
- data GetModIface = GetModIface
- data GetModIfaceFromDiskAndIndex = GetModIfaceFromDiskAndIndex
- data GetModIfaceFromDisk = GetModIfaceFromDisk
- newtype GhcSessionDeps where
- GhcSessionDeps_ { }
- pattern GhcSessionDeps :: GhcSessionDeps
- data GhcSession = GhcSession
- data GetBindings = GetBindings
- data GetHieAst = GetHieAst
- data GetDocMap = GetDocMap
- data TypeCheck = TypeCheck
- data ReportImportCycles = ReportImportCycles
- data GetModuleGraph = GetModuleGraph
- data GetDependencyInformation = GetDependencyInformation
- data NeedsCompilation = NeedsCompilation
- data GetLocatedImports = GetLocatedImports
- data GetParsedModuleWithComments = GetParsedModuleWithComments
- data GetParsedModule = GetParsedModule
- data ModSummaryResult = ModSummaryResult {}
- data IsFileOfInterestResult
- data FileOfInterestStatus
- data GetFileExists = GetFileExists
- data GetFileContents = GetFileContents
- data FileVersion
- newtype 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
- encodeLinkableType :: Maybe LinkableType -> ByteString
- tmrModSummary :: TcModuleResult -> ModSummary
- hiFileFingerPrint :: HiFileResult -> ByteString
- mkHiFileResult :: ModSummary -> HomeModInfo -> ModuleEnv UTCTime -> HiFileResult
- hirModIface :: HiFileResult -> ModIface
- vfsVersion :: FileVersion -> Maybe Int32
- 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 LoggingColumn
- newtype Recorder msg = Recorder {}
- data WithPriority a = WithPriority {
- priority :: Priority
- callStack_ :: CallStack
- payload :: a
- newtype Logger = Logger {
- logPriority :: Priority -> Text -> IO ()
- data Priority
- logError :: Logger -> Text -> IO ()
- logWarning :: Logger -> Text -> IO ()
- logInfo :: Logger -> Text -> IO ()
- logDebug :: Logger -> Text -> IO ()
- noLogging :: Logger
- logWith :: (HasCallStack, MonadIO m) => Recorder (WithPriority msg) -> Priority -> msg -> m ()
- cmap :: (a -> b) -> Recorder b -> Recorder a
- cmapWithPrio :: (a -> b) -> Recorder (WithPriority b) -> Recorder (WithPriority a)
- cmapIO :: (a -> IO b) -> Recorder b -> Recorder a
- cfilter :: (a -> Bool) -> Recorder a -> Recorder a
- makeDefaultStderrRecorder :: MonadIO m => Maybe [LoggingColumn] -> Priority -> m (Recorder (WithPriority (Doc a)))
- withDefaultRecorder :: MonadUnliftIO m => Maybe FilePath -> Maybe [LoggingColumn] -> Priority -> (Recorder (WithPriority (Doc d)) -> m a) -> m a
- priorityToHsLoggerPriority :: Priority -> Priority
- withBacklog :: (v -> Recorder a) -> IO (Recorder a, v -> IO ())
- lspClientMessageRecorder :: LanguageContextEnv config -> Recorder (WithPriority Text)
- lspClientLogRecorder :: LanguageContextEnv config -> Recorder (WithPriority Text)
- data RuleBody k v
- = Rule (k -> NormalizedFilePath -> Action (Maybe ByteString, IdeResult v))
- | RuleNoDiagnostics (k -> NormalizedFilePath -> Action (Maybe ByteString, Maybe v))
- | RuleWithCustomNewnessCheck {
- newnessCheck :: ByteString -> ByteString -> Bool
- build :: k -> NormalizedFilePath -> Action (Maybe ByteString, Maybe v)
- | RuleWithOldValue (k -> NormalizedFilePath -> Value v -> Action (Maybe ByteString, IdeResult v))
- data FastResult a = FastResult {}
- newtype IdeAction a = IdeAction {}
- data VFSModified
- data IdeState
- type IdeRule k v = (RuleResult k ~ v, ShakeValue k, Show v, Typeable v, NFData v)
- data ShakeExtras
- getPluginConfig :: MonadLsp Config m => PluginId -> m PluginConfig
- define :: IdeRule k v => Recorder (WithPriority Log) -> (k -> NormalizedFilePath -> Action (IdeResult v)) -> Rules ()
- defineNoDiagnostics :: IdeRule k v => Recorder (WithPriority Log) -> (k -> NormalizedFilePath -> Action (Maybe 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 => Recorder (WithPriority Log) -> RuleBody k v -> Rules ()
- ideLogger :: IdeState -> Logger
- actionLogger :: Action Logger
- data Plugin c = Plugin {
- pluginRules :: Rules ()
- pluginHandlers :: Handlers (ServerM c)
- pluginModifyDynflags :: c -> DynFlagsModifications
- getFilesOfInterestUntracked :: 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]))
- useE :: IdeRule k v => k -> NormalizedFilePath -> MaybeT IdeAction (v, PositionMapping)
- useNoFileE :: IdeRule k v => IdeState -> k -> MaybeT IdeAction v
- usesE :: IdeRule k v => k -> [NormalizedFilePath] -> MaybeT IdeAction [(v, PositionMapping)]
- getDefinition :: NormalizedFilePath -> Position -> IdeAction (Maybe [Location])
- getTypeDefinition :: NormalizedFilePath -> Position -> IdeAction (Maybe [Location])
- getParsedModule :: NormalizedFilePath -> Action (Maybe ParsedModule)
- getClientConfigAction :: Config -> Action Config
Documentation
(<>) :: Semigroup a => a -> a -> a infixr 6 #
An associative operation.
>>>
[1,2,3] <> [4,5,6]
[1,2,3,4,5,6]
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. |
|
type family RuleResult key #
The type mapping between the key
or a rule and the resulting value
.
Instances
type RuleResult NonLocalCompletions Source # | |
type RuleResult LocalCompletions Source # | Produce completions info for a file |
Defined in Development.IDE.Plugin.Completions.Types | |
type RuleResult GhcSessionIO Source # | |
Defined in Development.IDE.Core.RuleTypes | |
type RuleResult AddWatchedFile 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 and preprocessed content elided, for more successful early cutoff |
type RuleResult IsFileOfInterest Source # | |
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 This rule is also responsible for calling ReportImportCycles for the direct 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 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 GetFileExists Source # | |
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 GetGlobalBindingTypeSigs Source # | |
type RuleResult (Q k) Source # | |
Defined in Development.IDE.Types.Shake |
Instances
getClientConfig :: MonadLsp Config m => m Config #
Returns the current client configuration. It is not wise to permanently cache the returned value of this function, as clients can at runitime change their configuration.
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.4.0.1-KkYKenBF7kF5FxcHFj59QO" 'False) (C1 ('MetaCons "Location" 'PrefixI 'True) (S1 ('MetaSel ('Just "_uri") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Uri) :*: S1 ('MetaSel ('Just "_range") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (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
renderStrict :: SimpleDocStream ann -> Text #
(
takes the output renderStrict
sdoc)sdoc
from a rendering function
and transforms it to strict text.
layoutCompact :: Doc ann1 -> SimpleDocStream ann2 #
(layoutCompact x)
lays out the document x
without adding any
indentation and without preserving annotations.
Since no 'pretty' printing is involved, this layouter is very
fast. The resulting output contains fewer characters than a prettyprinted
version and can be used for output that is read by other programs.
>>>
let doc = hang 4 (vsep ["lorem", "ipsum", hang 4 (vsep ["dolor", "sit"])])
>>>
doc
lorem ipsum dolor sit
>>>
let putDocCompact = renderIO System.IO.stdout . layoutCompact
>>>
putDocCompact doc
lorem ipsum dolor sit
layoutSmart :: LayoutOptions -> Doc ann -> SimpleDocStream ann #
A layout algorithm with more lookahead than layoutPretty
, that introduces
line breaks earlier if the content does not (or will not, rather) fit into
one line.
Consider the following python-ish document,
>>>
let fun x = hang 2 ("fun(" <> softline' <> x) <> ")"
>>>
let doc = (fun . fun . fun . fun . fun) (align (list ["abcdef", "ghijklm"]))
which we’ll be rendering using the following pipeline (where the layout algorithm has been left open):
>>>
import Data.Text.IO as T
>>>
import Prettyprinter.Render.Text
>>>
let hr = pipe <> pretty (replicate (26-2) '-') <> pipe
>>>
let go layouter x = (T.putStrLn . renderStrict . layouter (LayoutOptions (AvailablePerLine 26 1))) (vsep [hr, x, hr])
If we render this using layoutPretty
with a page width of 26 characters
per line, all the fun
calls fit into the first line so they will be put
there:
>>>
go layoutPretty doc
|------------------------| fun(fun(fun(fun(fun( [ abcdef , ghijklm ]))))) |------------------------|
Note that this exceeds the desired 26 character page width. The same
document, rendered with
, fits the layout contstraints:layoutSmart
>>>
go layoutSmart doc
|------------------------| fun( fun( fun( fun( fun( [ abcdef , ghijklm ]))))) |------------------------|
The key difference between layoutPretty
and layoutSmart
is that the
latter will check the potential document until it encounters a line with the
same indentation or less than the start of the document. Any line encountered
earlier is assumed to belong to the same syntactic structure.
layoutPretty
checks only the first line.
Consider for example the question of whether the A
s fit into the document
below:
1 A 2 A 3 A 4 B 5 B
layoutPretty
will check only line 1, ignoring whether e.g. line 2 might
already be too wide.
By contrast, layoutSmart
stops only once it reaches line 4, where the B
has the same indentation as the first A
.
layoutPretty :: LayoutOptions -> Doc ann -> SimpleDocStream ann #
This is the default layout algorithm, and it is used by show
, putDoc
and hPutDoc
.
commits to rendering something in a certain way if the next
element fits the layout constraints; in other words, it has one
layoutPretty
SimpleDocStream
element lookahead when rendering. Consider using the
smarter, but a bit less performant,
algorithm if the results
seem to run off to the right before having lots of line breaks.layoutSmart
defaultLayoutOptions :: LayoutOptions #
The default layout options, suitable when you just want some output, and
don’t particularly care about the details. Used by the Show
instance, for
example.
>>>
defaultLayoutOptions
LayoutOptions {layoutPageWidth = AvailablePerLine 80 1.0}
removeTrailingWhitespace :: SimpleDocStream ann -> SimpleDocStream ann #
Remove all trailing space characters.
This has some performance impact, because it does an entire additional pass
over the SimpleDocStream
.
No trimming will be done inside annotations, which are considered to contain
no (trimmable) whitespace, since the annotation might actually be about the
whitespace, for example a renderer that colors the background of trailing
whitespace, as e.g. git diff
can be configured to do.
Historical note: Since v1.7.0, layoutPretty
and layoutSmart
avoid
producing the trailing whitespace that was the original motivation for
creating removeTrailingWhitespace
.
See https://github.com/quchen/prettyprinter/pull/139 for some background
info.
fuse :: FusionDepth -> Doc ann -> Doc ann #
(
combines text nodes so they can be rendered more
efficiently. A fused document is always laid out identical to its unfused
version.fuse
depth doc)
When laying a Doc
ument out to a SimpleDocStream
, every component of the
input is translated directly to the simpler output format. This sometimes
yields undesirable chunking when many pieces have been concatenated together.
For example
>>>
"a" <> "b" <> pretty 'c' <> "d"
abcd
results in a chain of four entries in a SimpleDocStream
, although this is fully
equivalent to the tightly packed
>>>
"abcd" :: Doc ann
abcd
which is only a single SimpleDocStream
entry, and can be processed faster.
It is therefore a good idea to run fuse
on concatenations of lots of small
strings that are used many times:
>>>
let oftenUsed = fuse Shallow ("a" <> "b" <> pretty 'c' <> "d")
>>>
hsep (replicate 5 oftenUsed)
abcd abcd abcd abcd abcd
alterAnnotationsS :: (ann -> Maybe ann') -> SimpleDocStream ann -> SimpleDocStream ann' #
Change the annotation of a document to a different annotation, or none at
all. alterAnnotations
for SimpleDocStream
.
Note that the Doc
version is more flexible, since it allows changing a
single annotation to multiple ones.
(SimpleDocTree
restores
this flexibility again.)
reAnnotateS :: (ann -> ann') -> SimpleDocStream ann -> SimpleDocStream ann' #
Change the annotation of a document. reAnnotate
for SimpleDocStream
.
unAnnotateS :: SimpleDocStream ann -> SimpleDocStream xxx #
Remove all annotations. unAnnotate
for SimpleDocStream
.
alterAnnotations :: (ann -> [ann']) -> Doc ann -> Doc ann' #
Change the annotations of a Doc
ument. Individual annotations can be
removed, changed, or replaced by multiple ones.
This is a general function that combines unAnnotate
and reAnnotate
, and
it is useful for mapping semantic annotations (such as »this is a keyword«)
to display annotations (such as »this is red and underlined«), because some
backends may not care about certain annotations, while others may.
Annotations earlier in the new list will be applied earlier, i.e. returning
[Bold, Green]
will result in a bold document that contains green text, and
not vice-versa.
Since this traverses the entire
tree, including parts that are not
rendered due to other layouts fitting better, it is preferrable to reannotate
after producing the layout by using Doc
.alterAnnotationsS
reAnnotate :: (ann -> ann') -> Doc ann -> Doc ann' #
Change the annotation of a Doc
ument.
Useful in particular to embed documents with one form of annotation in a more generally annotated document.
Since this traverses the entire
tree, including parts that are not
rendered due to other layouts fitting better, it is preferrable to reannotate
after producing the layout by using Doc
.reAnnotateS
Since
has the right type and satisfies reAnnotate
'reAnnotate id = id'
,
it is used to define the
instance of Functor
.Doc
unAnnotate :: Doc ann -> Doc xxx #
Remove all annotations.
Although unAnnotate
is idempotent with respect to rendering,
unAnnotate
.unAnnotate
=unAnnotate
it should not be used without caution, for each invocation traverses the
entire contained document. If possible, it is preferrable to unannotate after
producing the layout by using unAnnotateS
.
annotate :: ann -> Doc ann -> Doc ann #
Add an annotation to a
. This annotation can then be used by the
renderer to e.g. add color to certain parts of the output. For a full
tutorial example on how to use it, see the
Prettyprinter.Render.Tutorials.StackMachineTutorial or
Prettyprinter.Render.Tutorials.TreeRenderingTutorial modules.Doc
This function is only relevant for custom formats with their own annotations, and not relevant for basic prettyprinting. The predefined renderers, e.g. Prettyprinter.Render.Text, should be enough for the most common needs.
(
is plural
n one many)one
if n
is 1
, and many
otherwise. A
typical use case is adding a plural "s".
>>>
let things = [True]
>>>
let amount = length things
>>>
pretty things <+> "has" <+> pretty amount <+> plural "entry" "entries" amount
[True] has 1 entry
(
first lays out the document fillBreak
i x)x
. It then appends space
s
until the width is equal to i
. If the width of x
is already larger than
i
, the nesting level is increased by i
and a line
is appended. When we
redefine ptype
in the example given in fill
to use
, we get
a useful variation of the output:fillBreak
>>>
let types = [("empty","Doc"), ("nest","Int -> Doc -> Doc"), ("fillSep","[Doc] -> Doc")]
>>>
let ptype (name, tp) = fillBreak 5 (pretty name) <+> "::" <+> pretty tp
>>>
"let" <+> align (vcat (map ptype types))
let empty :: Doc nest :: Int -> Doc -> Doc fillSep :: [Doc] -> Doc
(
lays out the document fill
i x)x
. It then appends space
s until
the width is equal to i
. If the width of x
is already larger, nothing is
appended.
This function is quite useful in practice to output a list of bindings:
>>>
let types = [("empty","Doc"), ("nest","Int -> Doc -> Doc"), ("fillSep","[Doc] -> Doc")]
>>>
let ptype (name, tp) = fill 5 (pretty name) <+> "::" <+> pretty tp
>>>
"let" <+> align (vcat (map ptype types))
let empty :: Doc nest :: Int -> Doc -> Doc fillSep :: [Doc] -> Doc
pageWidth :: (PageWidth -> Doc ann) -> Doc ann #
Layout a document depending on the page width, if one has been specified.
>>>
let prettyPageWidth (AvailablePerLine l r) = "Width:" <+> pretty l <> ", ribbon fraction:" <+> pretty r
>>>
let doc = "prefix" <+> pageWidth (brackets . prettyPageWidth)
>>>
putDocW 32 (vsep [indent n doc | n <- [0,4,8]])
prefix [Width: 32, ribbon fraction: 1.0] prefix [Width: 32, ribbon fraction: 1.0] prefix [Width: 32, ribbon fraction: 1.0]
width :: Doc ann -> (Int -> Doc ann) -> Doc ann #
(
lays out the document width
doc f)doc
, and makes the column width
of it available to a function.
>>>
let annotate doc = width (brackets doc) (\w -> " <- width:" <+> pretty w)
>>>
align (vsep (map annotate ["---", "------", indent 3 "---", vsep ["---", indent 4 "---"]]))
[---] <- width: 5 [------] <- width: 8 [ ---] <- width: 8 [--- ---] <- width: 8
column :: (Int -> Doc ann) -> Doc ann #
Layout a document depending on which column it starts at. align
is
implemented in terms of column
.
>>>
column (\l -> "Columns are" <+> pretty l <> "-based.")
Columns are 0-based.
>>>
let doc = "prefix" <+> column (\l -> "| <- column" <+> pretty l)
>>>
vsep [indent n doc | n <- [0,4,8]]
prefix | <- column 7 prefix | <- column 11 prefix | <- column 15
(
appends punctuate
p xs)p
to all but the last document in xs
.
>>>
let docs = punctuate comma (Util.words "lorem ipsum dolor sit amet")
>>>
putDocW 80 (hsep docs)
lorem, ipsum, dolor, sit, amet
The separators are put at the end of the entries, which we can see if we position the result vertically:
>>>
putDocW 20 (vsep docs)
lorem, ipsum, dolor, sit, amet
If you want put the commas in front of their elements instead of at the end,
you should use tupled
or, in general, encloseSep
.
(
tries laying out the documents cat
xs)xs
separated with nothing,
and if this does not fit the page, separates them with newlines. This is what
differentiates it from vcat
, which always lays out its contents beneath
each other.
>>>
let docs = Util.words "lorem ipsum dolor"
>>>
putDocW 80 ("Docs:" <+> cat docs)
Docs: loremipsumdolor
When there is enough space, the documents are put above one another:
>>>
putDocW 10 ("Docs:" <+> cat docs)
Docs: lorem ipsum dolor
cat
=group
.vcat
fillCat :: [Doc ann] -> Doc ann #
(
concatenates documents fillCat
xs)xs
horizontally with
as
long as it fits the page, then inserts a <>
and continues doing that
for all documents in line'
xs
. This is similar to how an ordinary word processor
lays out the text if you just keep typing after you hit the maximum line
length.
(
means that if line'
group
ed, the documents are separated with nothing
instead of newlines. See fillSep
if you want a space
instead.)
Observe the difference between fillSep
and fillCat
. fillSep
concatenates the entries space
d when group
ed:
>>>
let docs = take 20 (cycle (["lorem", "ipsum", "dolor", "sit", "amet"]))
>>>
putDocW 40 ("Grouped:" <+> group (fillSep docs))
Grouped: lorem ipsum dolor sit amet lorem ipsum dolor sit amet lorem ipsum dolor sit amet lorem ipsum dolor sit amet
On the other hand, fillCat
concatenates the entries directly when
group
ed:
>>>
putDocW 40 ("Grouped:" <+> group (fillCat docs))
Grouped: loremipsumdolorsitametlorem ipsumdolorsitametloremipsumdolorsitamet loremipsumdolorsitamet
vcat :: [Doc ann] -> Doc ann #
(
vertically concatenates the documents vcat
xs)xs
. If it is
group
ed, the line breaks are removed.
In other words
is like vcat
, with newlines removed instead of
replaced by vsep
space
s.
>>>
let docs = Util.words "lorem ipsum dolor"
>>>
vcat docs
lorem ipsum dolor>>>
group (vcat docs)
loremipsumdolor
Since group
ing a vcat
is rather common, cat
is a built-in shortcut for
it.
(
tries laying out the documents sep
xs)xs
separated with space
s,
and if this does not fit the page, separates them with newlines. This is what
differentiates it from vsep
, which always lays out its contents beneath
each other.
>>>
let doc = "prefix" <+> sep ["text", "to", "lay", "out"]
>>>
putDocW 80 doc
prefix text to lay out
With a narrower layout, the entries are separated by newlines:
>>>
putDocW 20 doc
prefix text to lay out
sep
=group
.vsep
fillSep :: [Doc ann] -> Doc ann #
(
concatenates the documents fillSep
xs)xs
horizontally with
as long as it fits the page, then inserts a <+>
and continues doing that
for all documents in line
xs
. (
means that if line
group
ed, the documents
are separated with a space
instead of newlines. Use fillCat
if you do not
want a space
.)
Let's print some words to fill the line:
>>>
let docs = take 20 (cycle ["lorem", "ipsum", "dolor", "sit", "amet"])
>>>
putDocW 80 ("Docs:" <+> fillSep docs)
Docs: lorem ipsum dolor sit amet lorem ipsum dolor sit amet lorem ipsum dolor sit amet lorem ipsum dolor sit amet
The same document, printed at a width of only 40, yields
>>>
putDocW 40 ("Docs:" <+> fillSep docs)
Docs: lorem ipsum dolor sit amet lorem ipsum dolor sit amet lorem ipsum dolor sit amet lorem ipsum dolor sit amet
vsep :: [Doc ann] -> Doc ann #
(
concatenates all documents vsep
xs)xs
above each other. If a
group
undoes the line breaks inserted by vsep
, the documents are
separated with a space
instead.
Using vsep
alone yields
>>>
"prefix" <+> vsep ["text", "to", "lay", "out"]
prefix text to lay out
group
ing a vsep
separates the documents with a space
if it fits the
page (and does nothing otherwise). See the
convenience function for
this use case.sep
The align
function can be used to align the documents under their first
element:
>>>
"prefix" <+> align (vsep ["text", "to", "lay", "out"])
prefix text to lay out
Since group
ing a vsep
is rather common, sep
is a built-in for doing
that.
hsep :: [Doc ann] -> Doc ann #
(
concatenates all documents hsep
xs)xs
horizontally with
,
i.e. it puts a space between all entries.<+>
>>>
let docs = Util.words "lorem ipsum dolor sit amet"
>>>
hsep docs
lorem ipsum dolor sit amet
does not introduce line breaks on its own, even when the page is too
narrow:hsep
>>>
putDocW 5 (hsep docs)
lorem ipsum dolor sit amet
For automatic line breaks, consider using fillSep
instead.
concatWith :: Foldable t => (Doc ann -> Doc ann -> Doc ann) -> t (Doc ann) -> Doc ann #
Concatenate all documents element-wise with a binary function.
concatWith
_ [] =mempty
concatWith
(**) [x,y,z] = x ** y ** z
Multiple convenience definitions based on concatWith
are already predefined,
for example:
hsep
=concatWith
(<+>
)fillSep
=concatWith
(\x y -> x<>
softline
<>
y)
This is also useful to define customized joiners:
>>>
concatWith (surround dot) ["Prettyprinter", "Render", "Text"]
Prettyprinter.Render.Text
tupled :: [Doc ann] -> Doc ann #
Haskell-inspired variant of encloseSep
with parentheses and comma as
separator.
>>>
let doc = tupled (map pretty [1,20,300,4000])
>>>
putDocW 80 doc
(1, 20, 300, 4000)
>>>
putDocW 10 doc
( 1 , 20 , 300 , 4000 )
list :: [Doc ann] -> Doc ann #
Haskell-inspired variant of encloseSep
with braces and comma as
separator.
>>>
let doc = list (map pretty [1,20,300,4000])
>>>
putDocW 80 doc
[1, 20, 300, 4000]
>>>
putDocW 10 doc
[ 1 , 20 , 300 , 4000 ]
:: Doc ann | left delimiter |
-> Doc ann | right delimiter |
-> Doc ann | separator |
-> [Doc ann] | input documents |
-> Doc ann |
(
concatenates the documents encloseSep
l r sep xs)xs
separated by
sep
, and encloses the resulting document by l
and r
.
The documents are laid out horizontally if that fits the page:
>>>
let doc = "list" <+> align (encloseSep lbracket rbracket comma (map pretty [1,20,300,4000]))
>>>
putDocW 80 doc
list [1,20,300,4000]
If there is not enough space, then the input is split into lines entry-wise therwise they are laid out vertically, with separators put in the front:
>>>
putDocW 10 doc
list [1 ,20 ,300 ,4000]
Note that doc
contains an explicit call to align
so that the list items
are aligned vertically.
For putting separators at the end of entries instead, have a look at
punctuate
.
(
lays out the document hang
i x)x
with a nesting level set to the
current column plus i
. Negative values are allowed, and decrease the
nesting level accordingly.
>>>
let doc = reflow "Indenting these words with hang"
>>>
putDocW 24 ("prefix" <+> hang 4 doc)
prefix Indenting these words with hang
This differs from nest
, which is based on the current nesting level plus
i
. When you're not sure, try the more efficient nest
first. In our
example, this would yield
>>>
let doc = reflow "Indenting these words with nest"
>>>
putDocW 24 ("prefix" <+> nest 4 doc)
prefix Indenting these words with nest
hang
i doc =align
(nest
i doc)
(
lays out the document align
x)x
with the nesting level set to the
current column. It is used for example to implement hang
.
As an example, we will put a document right above another one, regardless of
the current nesting level. Without align
ment, the second line is put simply
below everything we've had so far:
>>>
"lorem" <+> vsep ["ipsum", "dolor"]
lorem ipsum dolor
If we add an align
to the mix, the
's contents all start in the
same column:vsep
>>>
"lorem" <+> align (vsep ["ipsum", "dolor"])
lorem ipsum dolor
By default, (
renders as flatAlt
x y)x
. However when group
ed,
y
will be preferred, with x
as the fallback for the case when y
doesn't fit.
>>>
let doc = flatAlt "a" "b"
>>>
putDoc doc
a>>>
putDoc (group doc)
b>>>
putDocW 0 (group doc)
a
flatAlt
is particularly useful for defining conditional separators such as
softline =group
(flatAlt
hardline
" ")
>>>
let hello = "Hello" <> softline <> "world!"
>>>
putDocW 12 hello
Hello world!>>>
putDocW 11 hello
Hello world!
Example: Haskell's do-notation
We can use this to render Haskell's do-notation nicely:
>>>
let open = flatAlt "" "{ "
>>>
let close = flatAlt "" " }"
>>>
let separator = flatAlt "" "; "
>>>
let prettyDo xs = group ("do" <+> align (encloseSep open close separator xs))
>>>
let statements = ["name:_ <- getArgs", "let greet = \"Hello, \" <> name", "putStrLn greet"]
This is put into a single line with {;}
style if it fits:
>>>
putDocW 80 (prettyDo statements)
do { name:_ <- getArgs; let greet = "Hello, " <> name; putStrLn greet }
When there is not enough space the statements are broken up into lines nicely:
>>>
putDocW 10 (prettyDo statements)
do name:_ <- getArgs let greet = "Hello, " <> name putStrLn greet
Notes
Users should be careful to choose x
to be less wide than y
.
Otherwise, if y
turns out not to fit the page, we fall back on an even
wider layout:
>>>
let ugly = group (flatAlt "even wider" "too wide")
>>>
putDocW 7 ugly
even wider
Also note that group
will flatten y
:
>>>
putDoc (group (flatAlt "x" ("y" <> line <> "y")))
y y
This also means that an "unflattenable" y
which contains a hard linebreak
will never be rendered:
>>>
putDoc (group (flatAlt "x" ("y" <> hardline <> "y")))
x
(
tries laying out group
x)x
into a single line by removing the
contained line breaks; if this does not fit the page, or when a hardline
within x
prevents it from being flattened, x
is laid out without any
changes.
The group
function is key to layouts that adapt to available space nicely.
See vcat
, line
, or flatAlt
for examples that are related, or make good
use of it.
A
is always laid out as a line break, even when hardline
group
ed or
when there is plenty of space. Note that it might still be simply discarded
if it is part of a flatAlt
inside a group
.
>>>
let doc = "lorem ipsum" <> hardline <> "dolor sit amet"
>>>
putDocW 1000 doc
lorem ipsum dolor sit amet
>>>
group doc
lorem ipsum dolor sit amet
is like softline'
, but behaves like softline
if the
resulting output does not fit on the page (instead of mempty
). In other
words, space
is to line
how line'
is to softline
.softline'
With enough space, we get direct concatenation:
>>>
let doc = "ThisWord" <> softline' <> "IsWayTooLong"
>>>
putDocW 80 doc
ThisWordIsWayTooLong
If we narrow the page to width 10, the layouter produces a line break:
>>>
putDocW 10 doc
ThisWord IsWayTooLong
softline'
=group
line'
softline
behaves like
if the resulting output fits the page,
otherwise like space
.line
Here, we have enough space to put everything in one line:
>>>
let doc = "lorem ipsum" <> softline <> "dolor sit amet"
>>>
putDocW 80 doc
lorem ipsum dolor sit amet
If we narrow the page to width 10, the layouter produces a line break:
>>>
putDocW 10 doc
lorem ipsum dolor sit amet
softline
=group
line
(
lays out the document nest
i x)x
with the current nesting level
(indentation of the following lines) increased by i
. Negative values are
allowed, and decrease the nesting level accordingly.
>>>
vsep [nest 4 (vsep ["lorem", "ipsum", "dolor"]), "sit", "amet"]
lorem ipsum dolor sit amet
See also
unsafeViaShow :: Show a => a -> Doc ann #
viaShow :: Show a => a -> Doc ann #
Convenience function to convert a Show
able value to a Doc
. If the
String
does not contain newlines, consider using the more performant
unsafeViaShow
.
The abstract data type
represents pretty documents that have
been annotated with data of type Doc
annann
.
More specifically, a value of type
represents a non-empty set of
possible layouts of a document. The layout functions select one of these
possibilities, taking into account things like the width of the output
document.Doc
The annotation is an arbitrary piece of data associated with (part of) a document. Annotations may be used by the rendering backends in order to display output differently, such as
- color information (e.g. when rendering to the terminal)
- mouseover text (e.g. when rendering to rich HTML)
- whether to show something or not (to allow simple or detailed versions)
The simplest way to display a Doc
is via the Show
class.
>>>
putStrLn (show (vsep ["hello", "world"]))
hello world
Instances
>>>
pretty 1 <+> pretty "hello" <+> pretty 1.234
1 hello 1.234
prettyList :: [a] -> Doc ann #
is only used to define the prettyList
instance
. In normal circumstances only the Pretty
a => Pretty
[a]
function is used.pretty
>>>
prettyList [1, 23, 456]
[1, 23, 456]
Instances
Pretty Bool |
|
Defined in Prettyprinter.Internal | |
Pretty Char | Instead of
|
Defined in Prettyprinter.Internal | |
Pretty Double |
|
Defined in Prettyprinter.Internal | |
Pretty Float |
|
Defined in Prettyprinter.Internal | |
Pretty Int |
|
Defined in Prettyprinter.Internal | |
Pretty Int8 | |
Defined in Prettyprinter.Internal | |
Pretty Int16 | |
Defined in Prettyprinter.Internal | |
Pretty Int32 | |
Defined in Prettyprinter.Internal | |
Pretty Int64 | |
Defined in Prettyprinter.Internal | |
Pretty Integer |
|
Defined in Prettyprinter.Internal | |
Pretty Natural | |
Defined in Prettyprinter.Internal | |
Pretty Word | |
Defined in Prettyprinter.Internal | |
Pretty Word8 | |
Defined in Prettyprinter.Internal | |
Pretty Word16 | |
Defined in Prettyprinter.Internal | |
Pretty Word32 | |
Defined in Prettyprinter.Internal | |
Pretty Word64 | |
Defined in Prettyprinter.Internal | |
Pretty () |
The argument is not used:
|
Defined in Prettyprinter.Internal | |
Pretty Text | Automatically converts all newlines to
Note that
Manually use |
Defined in Prettyprinter.Internal | |
Pretty Text | (lazy |
Defined in Prettyprinter.Internal | |
Pretty Void | Finding a good example for printing something that does not exist is hard, so here is an example of printing a list full of nothing.
|
Defined in Prettyprinter.Internal | |
Pretty Log Source # | |
Defined in Development.IDE.Main.HeapStats | |
Pretty Log Source # | |
Defined in Development.IDE.Core.Shake | |
Pretty Log Source # | |
Defined in Development.IDE.Session | |
Pretty Log Source # | |
Defined in Development.IDE.Plugin.HLS | |
Pretty Log Source # | |
Defined in Development.IDE.Core.OfInterest | |
Pretty Log Source # | |
Defined in Development.IDE.Core.FileStore | |
Pretty Log Source # | |
Defined in Development.IDE.Core.Service | |
Pretty Log Source # | |
Defined in Development.IDE.GHC.ExactPrint | |
Pretty Log Source # | |
Defined in Development.IDE.Core.Rules | |
Pretty Log Source # | |
Defined in Development.IDE.LSP.LanguageServer | |
Pretty Log Source # | |
Defined in Development.IDE.Plugin.TypeLenses | |
Pretty Log Source # | |
Defined in Development.IDE.Plugin.Completions | |
Pretty Log Source # | |
Defined in Development.IDE.Plugin.HLS.GhcIde | |
Pretty Log Source # | |
Defined in Development.IDE.Main | |
Pretty a => Pretty [a] |
|
Defined in Prettyprinter.Internal | |
Pretty a => Pretty (Maybe a) | Ignore
|
Defined in Prettyprinter.Internal | |
Pretty a => Pretty (Identity a) |
|
Defined in Prettyprinter.Internal | |
Pretty a => Pretty (NonEmpty a) | |
Defined in Prettyprinter.Internal | |
(Pretty a1, Pretty a2) => Pretty (a1, a2) |
|
Defined in Prettyprinter.Internal | |
(Pretty a1, Pretty a2, Pretty a3) => Pretty (a1, a2, a3) |
|
Defined in Prettyprinter.Internal | |
Pretty a => Pretty (Const a b) | |
Defined in Prettyprinter.Internal |
data FusionDepth #
Fusion depth parameter, used by fuse
.
Shallow | Do not dive deep into nested documents, fusing mostly concatenations of text nodes together. |
Deep | Recurse into all parts of the This value should only be used if profiling shows it is significantly
faster than using |
Instances
Eq FusionDepth | |
Defined in Prettyprinter.Internal (==) :: FusionDepth -> FusionDepth -> Bool # (/=) :: FusionDepth -> FusionDepth -> Bool # | |
Ord FusionDepth | |
Defined in Prettyprinter.Internal compare :: FusionDepth -> FusionDepth -> Ordering # (<) :: FusionDepth -> FusionDepth -> Bool # (<=) :: FusionDepth -> FusionDepth -> Bool # (>) :: FusionDepth -> FusionDepth -> Bool # (>=) :: FusionDepth -> FusionDepth -> Bool # max :: FusionDepth -> FusionDepth -> FusionDepth # min :: FusionDepth -> FusionDepth -> FusionDepth # | |
Show FusionDepth | |
Defined in Prettyprinter.Internal showsPrec :: Int -> FusionDepth -> ShowS # show :: FusionDepth -> String # showList :: [FusionDepth] -> ShowS # |
data SimpleDocStream ann #
The data type SimpleDocStream
represents laid out documents and is used
by the display functions.
A simplified view is that
, and the layout
functions pick one of the Doc
= [SimpleDocStream
]SimpleDocStream
s based on which one fits the
layout constraints best. This means that SimpleDocStream
has all complexity
contained in Doc
resolved, making it very easy to convert it to other
formats, such as plain text or terminal output.
To write your own
to X converter, it is therefore sufficient to
convert from Doc
. The »Render« submodules provide some
built-in converters to do so, and helpers to create own ones.SimpleDocStream
SFail | |
SEmpty | |
SChar !Char (SimpleDocStream ann) | |
SText !Int !Text (SimpleDocStream ann) | |
SLine !Int (SimpleDocStream ann) |
|
SAnnPush ann (SimpleDocStream ann) | Add an annotation to the remaining document. |
SAnnPop (SimpleDocStream ann) | Remove a previously pushed annotation. |
Instances
Maximum number of characters that fit in one line. The layout algorithms
will try not to exceed the set limit by inserting line breaks when applicable
(e.g. via softline'
).
AvailablePerLine !Int !Double | Layouters should not exceed the specified space per line.
|
Unbounded | Layouters should not introduce line breaks on their own. |
newtype LayoutOptions #
Options to influence the layout algorithms.
Instances
Eq LayoutOptions | |
Defined in Prettyprinter.Internal (==) :: LayoutOptions -> LayoutOptions -> Bool # (/=) :: LayoutOptions -> LayoutOptions -> Bool # | |
Ord LayoutOptions | |
Defined in Prettyprinter.Internal compare :: LayoutOptions -> LayoutOptions -> Ordering # (<) :: LayoutOptions -> LayoutOptions -> Bool # (<=) :: LayoutOptions -> LayoutOptions -> Bool # (>) :: LayoutOptions -> LayoutOptions -> Bool # (>=) :: LayoutOptions -> LayoutOptions -> Bool # max :: LayoutOptions -> LayoutOptions -> LayoutOptions # min :: LayoutOptions -> LayoutOptions -> LayoutOptions # | |
Show LayoutOptions | |
Defined in Prettyprinter.Internal showsPrec :: Int -> LayoutOptions -> ShowS # show :: LayoutOptions -> String # showList :: [LayoutOptions] -> ShowS # |
data GhcVersion Source #
Instances
Eq GhcVersion Source # | |
Defined in Development.IDE.GHC.Compat (==) :: GhcVersion -> GhcVersion -> Bool # (/=) :: GhcVersion -> GhcVersion -> Bool # | |
Ord GhcVersion Source # | |
Defined in Development.IDE.GHC.Compat compare :: GhcVersion -> GhcVersion -> Ordering # (<) :: GhcVersion -> GhcVersion -> Bool # (<=) :: GhcVersion -> GhcVersion -> Bool # (>) :: GhcVersion -> GhcVersion -> Bool # (>=) :: GhcVersion -> GhcVersion -> Bool # max :: GhcVersion -> GhcVersion -> GhcVersion # min :: GhcVersion -> GhcVersion -> GhcVersion # | |
Show GhcVersion Source # | |
Defined in Development.IDE.GHC.Compat showsPrec :: Int -> GhcVersion -> ShowS # show :: GhcVersion -> String # showList :: [GhcVersion] -> ShowS # |
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 IdeResultNoDiagnosticsEarlyCutoff v = (Maybe ByteString, Maybe v) Source #
an IdeResult with a fingerprint
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 :: Unit -> HscEnv -> Maybe UnitInfo Source #
Given a Unit
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).
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
.
fingerprintFromPut :: Put -> IO Fingerprint Source #
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.
traceAst :: (Data a, ExactPrint a, Outputable a, HasCallStack) => String -> a -> a Source #
Prints an Outputable
value to stderr and to an HTML file for further inspection
printOutputable :: Outputable a => a -> Text Source #
Print a GHC value in defaultUserStyle
without unique symbols.
This is the most common print utility, will print with a user-friendly style like: a_a4ME
as a
.
It internal using showSDocUnsafe
with unsafeGlobalDynFlags
.
diagFromErrMsg :: Text -> DynFlags -> MsgEnvelope DecoratedSDoc -> [FileDiagnostic] Source #
Produce a GHC-style error from a source span and a message.
diagFromErrMsgs :: Text -> DynFlags -> Bag (MsgEnvelope DecoratedSDoc) -> [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
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 # | |
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 IdeGhcSession Source #
IdeGhcSession | |
|
Instances
Show IdeGhcSession Source # | |
Defined in Development.IDE.Core.RuleTypes showsPrec :: Int -> IdeGhcSession -> ShowS # show :: IdeGhcSession -> String # showList :: [IdeGhcSession] -> ShowS # | |
NFData IdeGhcSession Source # | |
Defined in Development.IDE.Core.RuleTypes rnf :: IdeGhcSession -> () # |
data AddWatchedFile Source #
Instances
Eq AddWatchedFile Source # | |
Defined in Development.IDE.Core.RuleTypes (==) :: AddWatchedFile -> AddWatchedFile -> Bool # (/=) :: AddWatchedFile -> AddWatchedFile -> Bool # | |
Show AddWatchedFile Source # | |
Defined in Development.IDE.Core.RuleTypes showsPrec :: Int -> AddWatchedFile -> ShowS # show :: AddWatchedFile -> String # showList :: [AddWatchedFile] -> ShowS # | |
Generic AddWatchedFile Source # | |
Defined in Development.IDE.Core.RuleTypes type Rep AddWatchedFile :: Type -> Type # from :: AddWatchedFile -> Rep AddWatchedFile x # to :: Rep AddWatchedFile x -> AddWatchedFile # | |
Hashable AddWatchedFile Source # | |
Defined in Development.IDE.Core.RuleTypes hashWithSalt :: Int -> AddWatchedFile -> Int # hash :: AddWatchedFile -> Int # | |
NFData AddWatchedFile Source # | |
Defined in Development.IDE.Core.RuleTypes rnf :: AddWatchedFile -> () # | |
type Rep AddWatchedFile Source # | |
type RuleResult AddWatchedFile 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 # | |
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 and preprocessed content elided, for more successful early cutoff |
data IsFileOfInterest Source #
Instances
Eq IsFileOfInterest Source # | |
Defined in Development.IDE.Core.RuleTypes (==) :: IsFileOfInterest -> IsFileOfInterest -> Bool # (/=) :: IsFileOfInterest -> IsFileOfInterest -> Bool # | |
Show IsFileOfInterest Source # | |
Defined in Development.IDE.Core.RuleTypes showsPrec :: Int -> IsFileOfInterest -> ShowS # show :: IsFileOfInterest -> String # showList :: [IsFileOfInterest] -> ShowS # | |
Generic IsFileOfInterest Source # | |
Defined in Development.IDE.Core.RuleTypes type Rep IsFileOfInterest :: Type -> Type # from :: IsFileOfInterest -> Rep IsFileOfInterest x # to :: Rep IsFileOfInterest x -> IsFileOfInterest # | |
Hashable IsFileOfInterest Source # | |
Defined in Development.IDE.Core.RuleTypes hashWithSalt :: Int -> IsFileOfInterest -> Int # hash :: IsFileOfInterest -> Int # | |
NFData IsFileOfInterest Source # | |
Defined in Development.IDE.Core.RuleTypes rnf :: IsFileOfInterest -> () # | |
type Rep IsFileOfInterest Source # | |
type RuleResult IsFileOfInterest Source # | |
Defined in Development.IDE.Core.RuleTypes |
data GetModIface Source #
Instances
Eq GetModIface Source # | |
Defined in Development.IDE.Core.RuleTypes (==) :: GetModIface -> GetModIface -> Bool # (/=) :: GetModIface -> GetModIface -> Bool # | |
Show GetModIface Source # | |
Defined in Development.IDE.Core.RuleTypes showsPrec :: Int -> GetModIface -> ShowS # show :: GetModIface -> String # showList :: [GetModIface] -> ShowS # | |
Generic GetModIface Source # | |
Defined in Development.IDE.Core.RuleTypes type Rep GetModIface :: Type -> Type # from :: GetModIface -> Rep GetModIface x # to :: Rep GetModIface x -> GetModIface # | |
Hashable GetModIface Source # | |
Defined in Development.IDE.Core.RuleTypes hashWithSalt :: Int -> GetModIface -> Int # hash :: GetModIface -> Int # | |
NFData GetModIface Source # | |
Defined in Development.IDE.Core.RuleTypes rnf :: GetModIface -> () # | |
type Rep GetModIface Source # | |
type RuleResult GetModIface Source # | Get a module interface details, either from an interface file or a typechecked module |
Defined in Development.IDE.Core.RuleTypes |
data GetModIfaceFromDiskAndIndex Source #
Instances
Eq GetModIfaceFromDiskAndIndex Source # | |
Show GetModIfaceFromDiskAndIndex Source # | |
Defined in Development.IDE.Core.RuleTypes showsPrec :: Int -> GetModIfaceFromDiskAndIndex -> ShowS # show :: GetModIfaceFromDiskAndIndex -> String # showList :: [GetModIfaceFromDiskAndIndex] -> ShowS # | |
Generic GetModIfaceFromDiskAndIndex Source # | |
Defined in Development.IDE.Core.RuleTypes type Rep GetModIfaceFromDiskAndIndex :: Type -> Type # | |
Hashable GetModIfaceFromDiskAndIndex Source # | |
Defined in Development.IDE.Core.RuleTypes hashWithSalt :: Int -> GetModIfaceFromDiskAndIndex -> Int # hash :: GetModIfaceFromDiskAndIndex -> Int # | |
NFData GetModIfaceFromDiskAndIndex Source # | |
Defined in Development.IDE.Core.RuleTypes rnf :: GetModIfaceFromDiskAndIndex -> () # | |
type Rep GetModIfaceFromDiskAndIndex Source # | |
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 |
data GetModIfaceFromDisk Source #
Instances
newtype GhcSessionDeps Source #
GhcSessionDeps_ | |
|
pattern GhcSessionDeps :: GhcSessionDeps |
Instances
Eq GhcSessionDeps Source # | |
Defined in Development.IDE.Core.RuleTypes (==) :: GhcSessionDeps -> GhcSessionDeps -> Bool # (/=) :: GhcSessionDeps -> GhcSessionDeps -> Bool # | |
Show GhcSessionDeps Source # | |
Defined in Development.IDE.Core.RuleTypes showsPrec :: Int -> GhcSessionDeps -> ShowS # show :: GhcSessionDeps -> String # showList :: [GhcSessionDeps] -> ShowS # | |
Hashable GhcSessionDeps Source # | |
Defined in Development.IDE.Core.RuleTypes hashWithSalt :: Int -> GhcSessionDeps -> Int # hash :: GhcSessionDeps -> Int # | |
NFData GhcSessionDeps Source # | |
Defined in Development.IDE.Core.RuleTypes rnf :: GhcSessionDeps -> () # | |
type RuleResult GhcSessionDeps Source # | A GHC session preloaded with all the dependencies This rule is also responsible for calling ReportImportCycles for the direct dependencies |
Defined in Development.IDE.Core.RuleTypes |
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 # | |
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 # | |
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 | |
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 | |
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 | |
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 ReportImportCycles Source #
Instances
data GetModuleGraph Source #
Instances
Eq GetModuleGraph Source # | |
Defined in Development.IDE.Core.RuleTypes (==) :: GetModuleGraph -> GetModuleGraph -> Bool # (/=) :: GetModuleGraph -> GetModuleGraph -> Bool # | |
Show GetModuleGraph Source # | |
Defined in Development.IDE.Core.RuleTypes showsPrec :: Int -> GetModuleGraph -> ShowS # show :: GetModuleGraph -> String # showList :: [GetModuleGraph] -> ShowS # | |
Generic GetModuleGraph Source # | |
Defined in Development.IDE.Core.RuleTypes type Rep GetModuleGraph :: Type -> Type # from :: GetModuleGraph -> Rep GetModuleGraph x # to :: Rep GetModuleGraph x -> GetModuleGraph # | |
Hashable GetModuleGraph Source # | |
Defined in Development.IDE.Core.RuleTypes hashWithSalt :: Int -> GetModuleGraph -> Int # hash :: GetModuleGraph -> Int # | |
NFData GetModuleGraph Source # | |
Defined in Development.IDE.Core.RuleTypes rnf :: GetModuleGraph -> () # | |
type Rep GetModuleGraph Source # | |
type RuleResult GetModuleGraph Source # | |
Defined in Development.IDE.Core.RuleTypes |
data GetDependencyInformation Source #
Instances
data NeedsCompilation Source #
Instances
data GetLocatedImports Source #
Instances
data GetParsedModuleWithComments Source #
Instances
Eq GetParsedModuleWithComments Source # | |
Show GetParsedModuleWithComments Source # | |
Defined in Development.IDE.Core.RuleTypes showsPrec :: Int -> GetParsedModuleWithComments -> ShowS # show :: GetParsedModuleWithComments -> String # showList :: [GetParsedModuleWithComments] -> ShowS # | |
Generic GetParsedModuleWithComments Source # | |
Defined in Development.IDE.Core.RuleTypes type Rep GetParsedModuleWithComments :: Type -> Type # | |
Hashable GetParsedModuleWithComments Source # | |
Defined in Development.IDE.Core.RuleTypes hashWithSalt :: Int -> GetParsedModuleWithComments -> Int # hash :: GetParsedModuleWithComments -> Int # | |
NFData GetParsedModuleWithComments Source # | |
Defined in Development.IDE.Core.RuleTypes rnf :: GetParsedModuleWithComments -> () # | |
type Rep GetParsedModuleWithComments Source # | |
type RuleResult GetParsedModuleWithComments Source # | The parse tree for the file using GetFileContents, all comments included using Opt_KeepRawTokenStream |
Defined in Development.IDE.Core.RuleTypes |
data GetParsedModule Source #
Instances
data ModSummaryResult Source #
ModSummaryResult | |
|
Instances
Show ModSummaryResult Source # | |
Defined in Development.IDE.Core.RuleTypes showsPrec :: Int -> ModSummaryResult -> ShowS # show :: ModSummaryResult -> String # showList :: [ModSummaryResult] -> ShowS # | |
NFData ModSummaryResult Source # | |
Defined in Development.IDE.Core.RuleTypes rnf :: ModSummaryResult -> () # |
data IsFileOfInterestResult Source #
Instances
data FileOfInterestStatus Source #
Instances
data GetFileExists Source #
Instances
Eq GetFileExists Source # | |
Defined in Development.IDE.Core.RuleTypes (==) :: GetFileExists -> GetFileExists -> Bool # (/=) :: GetFileExists -> GetFileExists -> Bool # | |
Show GetFileExists Source # | |
Defined in Development.IDE.Core.RuleTypes showsPrec :: Int -> GetFileExists -> ShowS # show :: GetFileExists -> String # showList :: [GetFileExists] -> ShowS # | |
Generic GetFileExists Source # | |
Defined in Development.IDE.Core.RuleTypes type Rep GetFileExists :: Type -> Type # from :: GetFileExists -> Rep GetFileExists x # to :: Rep GetFileExists x -> GetFileExists # | |
Hashable GetFileExists Source # | |
Defined in Development.IDE.Core.RuleTypes hashWithSalt :: Int -> GetFileExists -> Int # hash :: GetFileExists -> Int # | |
NFData GetFileExists Source # | |
Defined in Development.IDE.Core.RuleTypes rnf :: GetFileExists -> () # | |
type Rep GetFileExists Source # | |
type RuleResult GetFileExists Source # | |
Defined in Development.IDE.Core.RuleTypes |
data GetFileContents Source #
Instances
data FileVersion Source #
Either the mtime from disk or an LSP version LSP versions always compare as greater than on disk versions
Instances
newtype 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 # | |
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
Eq GenerateCore Source # | |
Defined in Development.IDE.Core.RuleTypes (==) :: GenerateCore -> GenerateCore -> Bool # (/=) :: GenerateCore -> GenerateCore -> Bool # | |
Show GenerateCore Source # | |
Defined in Development.IDE.Core.RuleTypes showsPrec :: Int -> GenerateCore -> ShowS # show :: GenerateCore -> String # showList :: [GenerateCore] -> ShowS # | |
Generic GenerateCore Source # | |
Defined in Development.IDE.Core.RuleTypes type Rep GenerateCore :: Type -> Type # from :: GenerateCore -> Rep GenerateCore x # to :: Rep GenerateCore x -> GenerateCore # | |
Hashable GenerateCore Source # | |
Defined in Development.IDE.Core.RuleTypes hashWithSalt :: Int -> GenerateCore -> Int # hash :: GenerateCore -> Int # | |
NFData GenerateCore Source # | |
Defined in Development.IDE.Core.RuleTypes rnf :: GenerateCore -> () # | |
type Rep GenerateCore Source # | |
type RuleResult GenerateCore Source # | Convert to Core, requires TypeCheck* |
Defined in Development.IDE.Core.RuleTypes |
data GetKnownTargets Source #
Instances
data LinkableType Source #
Instances
pattern GetModificationTime :: GetModificationTime Source #
encodeLinkableType :: Maybe LinkableType -> ByteString Source #
Encode the linkable into an ordered bytestring.
This is used to drive an ordered "newness" predicate in the
NeedsCompilation
build rule.
mkHiFileResult :: ModSummary -> HomeModInfo -> ModuleEnv UTCTime -> HiFileResult Source #
hirModIface :: HiFileResult -> ModIface Source #
vfsVersion :: FileVersion -> Maybe Int32 Source #
awSplicesL :: Lens' Splices [(LHsExpr GhcTc, Serialized)] Source #
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).
data WithPriority a Source #
WithPriority | |
|
Instances
Functor WithPriority Source # | |
Defined in Development.IDE.Types.Logger fmap :: (a -> b) -> WithPriority a -> WithPriority b # (<$) :: a -> WithPriority b -> WithPriority a # |
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 | |
|
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 # | |
logWith :: (HasCallStack, MonadIO m) => Recorder (WithPriority msg) -> Priority -> msg -> m () Source #
cmapWithPrio :: (a -> b) -> Recorder (WithPriority b) -> Recorder (WithPriority a) Source #
makeDefaultStderrRecorder :: MonadIO m => Maybe [LoggingColumn] -> Priority -> m (Recorder (WithPriority (Doc a))) Source #
Priority is actually for hslogger compatibility
:: MonadUnliftIO m | |
=> Maybe FilePath | Log file path. |
-> Maybe [LoggingColumn] | logging columns to display. |
-> Priority | min priority for hslogger compatibility |
-> (Recorder (WithPriority (Doc d)) -> m a) | action given a recorder |
-> m a |
If no path given then use stderr, otherwise use file.
Kinda complicated because we also need to setup hslogger
for
`hie-bios` log compatibility reasons. If `hie-bios` can be set to use our
logger instead or if `hie-bios` doesn't use hslogger
then hslogger
can
be removed completely. See setupHsLogger
comment.
lspClientMessageRecorder :: LanguageContextEnv config -> Recorder (WithPriority Text) Source #
Creates a recorder that sends logs to the LSP client via window/showMessage
notifications.
lspClientLogRecorder :: LanguageContextEnv config -> Recorder (WithPriority Text) Source #
Creates a recorder that sends logs to the LSP client via window/logMessage
notifications.
Rule (k -> NormalizedFilePath -> Action (Maybe ByteString, IdeResult v)) | |
RuleNoDiagnostics (k -> NormalizedFilePath -> Action (Maybe ByteString, Maybe v)) | |
RuleWithCustomNewnessCheck | |
| |
RuleWithOldValue (k -> NormalizedFilePath -> Value v -> Action (Maybe ByteString, IdeResult v)) |
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.
Run via runIdeAction
.
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 # |
getPluginConfig :: MonadLsp Config m => PluginId -> m PluginConfig Source #
define :: IdeRule k v => Recorder (WithPriority Log) -> (k -> NormalizedFilePath -> Action (IdeResult v)) -> Rules () Source #
Define a new Rule without early cutoff
defineNoDiagnostics :: IdeRule k v => Recorder (WithPriority Log) -> (k -> NormalizedFilePath -> Action (Maybe v)) -> Rules () Source #
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 #
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 => Recorder (WithPriority Log) -> RuleBody k v -> Rules () Source #
Define a new Rule with early cutoff
Plugin | |
|
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
getAtPoint :: NormalizedFilePath -> Position -> IdeAction (Maybe (Maybe Range, [Text])) Source #
Try to get hover text for the name under point.
useE :: IdeRule k v => k -> NormalizedFilePath -> MaybeT IdeAction (v, PositionMapping) Source #
useE is useful to implement functions that aren’t rules but need shortcircuiting e.g. getDefinition.
usesE :: IdeRule k v => k -> [NormalizedFilePath] -> MaybeT IdeAction [(v, PositionMapping)] Source #
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.