@@ -6,6 +6,7 @@
66-- | Options
77module Development.IDE.Types.Options
88 ( IdeOptions(..)
9+ , IdePreprocessedSource(..)
910 , IdeReportProgress(..)
1011 , IdeDefer(..)
1112 , clientSupportsProgress
@@ -21,9 +22,9 @@ import GhcPlugins as GHC hiding (fst3, (<>))
2122import qualified Language.Haskell.LSP.Types.Capabilities as LSP
2223
2324data IdeOptions = IdeOptions
24− { optPreprocessor :: GHC.ParsedSource -> ([(GHC.SrcSpan, String)], GHC.ParsedSource)
25+ { optPreprocessor :: GHC.ParsedSource -> IdePreprocessedSource
2526 -- ^ Preprocessor to run over all parsed source trees, generating a list of warnings
26− -- along with a new parse tree.
27+ -- and a list of errors, along with a new parse tree.
2728 , optGhcSession :: IO (FilePath -> Action HscEnvEq)
2829 -- ^ Setup a GHC session for a given file, e.g. @Foo.hs@.
2930 -- The 'IO' will be called once, then the resulting function will be applied once per file.
@@ -53,6 +54,15 @@ data IdeOptions = IdeOptions
5354 -- the presence of type errors, holes or unbound variables.
5455 }
5556
57+data IdePreprocessedSource = IdePreprocessedSource
58+ { preprocWarnings :: [(GHC.SrcSpan, String)]
59+ -- ^ Warnings emitted by the preprocessor.
60+ , preprocErrors :: [(GHC.SrcSpan, String)]
61+ -- ^ Errors emitted by the preprocessor.
62+ , preprocSource :: GHC.ParsedSource
63+ -- ^ New parse tree emitted by the preprocessor.
64+ }
65+
5666newtype IdeReportProgress = IdeReportProgress Bool
5767newtype IdeDefer = IdeDefer Bool
5868
@@ -62,7 +72,7 @@ clientSupportsProgress caps = IdeReportProgress $ fromMaybe False $
6272
6373defaultIdeOptions :: IO (FilePath -> Action HscEnvEq) -> IdeOptions
6474defaultIdeOptions session = IdeOptions
65− {optPreprocessor = (,) []
75+ {optPreprocessor = IdePreprocessedSource [] []
6676 ,optGhcSession = session
6777 ,optExtensions = ["hs", "lhs"]
6878 ,optPkgLocationOpts = defaultIdePkgLocationOptions