@@ -6,14 +6,17 @@
66-- | Options
77module Development.IDE.Types.Options
88 ( IdeOptions(..)
9+ , IdeReportProgress(..)
10+ , clientSupportsProgress
911 , IdePkgLocationOptions(..)
1012 , defaultIdeOptions
1113 ) where
1214
15+import Data.Maybe
1316import Development.Shake
1417import GHC hiding (parseModule, typecheckModule)
1518import GhcPlugins as GHC hiding (fst3, (<>))
16−
19+import qualified Language.Haskell.LSP.Types.Capabilities as LSP
1720
1821data IdeOptions = IdeOptions
1922 { optPreprocessor :: GHC.ParsedSource -> ([(GHC.SrcSpan, String)], GHC.ParsedSource)
@@ -25,10 +28,17 @@ data IdeOptions = IdeOptions
2528
2629 , optThreads :: Int
2730 , optShakeProfiling :: Maybe FilePath
31+ , optReportProgress :: IdeReportProgress
2832 , optLanguageSyntax :: String -- ^ the ```language to use
2933 , optNewColonConvention :: Bool -- ^ whether to use new colon convention
3034 }
3135
36+newtype IdeReportProgress = IdeReportProgress Bool
37+
38+clientSupportsProgress :: LSP.ClientCapabilities -> IdeReportProgress
39+clientSupportsProgress caps = IdeReportProgress $ fromMaybe False $
40+ LSP._progress =<< LSP._window (caps :: LSP.ClientCapabilities)
41+
3242defaultIdeOptions :: Action HscEnv -> IdeOptions
3343defaultIdeOptions session = IdeOptions
3444 {optPreprocessor = (,) []
@@ -37,6 +47,7 @@ defaultIdeOptions session = IdeOptions
3747 ,optPkgLocationOpts = defaultIdePkgLocationOptions
3848 ,optThreads = 0
3949 ,optShakeProfiling = Nothing
50+ ,optReportProgress = IdeReportProgress False
4051 ,optLanguageSyntax = "haskell"
4152 ,optNewColonConvention = False
4253 }