-
-
Notifications
You must be signed in to change notification settings - Fork 407
Add an option to control progress reporting #1513
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
e95ca9e
5afb65d
d2b15bc
365e3a6
0d9df1b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
-- SPDX-License-Identifier: Apache-2.0 | ||
|
||
-- | Options | ||
{-# LANGUAGE RankNTypes #-} | ||
module Development.IDE.Types.Options | ||
( IdeOptions(..) | ||
, IdePreprocessedSource(..) | ||
|
@@ -17,27 +18,17 @@ module Development.IDE.Types.Options | |
, OptHaddockParse(..) | ||
,optShakeFiles) where | ||
|
||
import Control.DeepSeq (NFData (..)) | ||
import qualified Data.Text as T | ||
import Data.Typeable | ||
import Development.IDE.Core.RuleTypes | ||
import Development.IDE.Types.Diagnostics | ||
import Development.IDE.Types.HscEnvEq (HscEnvEq) | ||
import Development.Shake | ||
import GHC hiding (parseModule, | ||
typecheckModule) | ||
import GhcPlugins as GHC hiding (fst3, (<>)) | ||
import Ide.Plugin.Config | ||
import qualified Language.LSP.Types.Capabilities as LSP | ||
|
||
data IdeGhcSession = IdeGhcSession | ||
{ loadSessionFun :: FilePath -> IO (IdeResult HscEnvEq, [FilePath]) | ||
-- ^ Returns the Ghc session and the cradle dependencies | ||
, sessionVersion :: !Int | ||
-- ^ Used as Shake key, versions must be unique and not reused | ||
} | ||
|
||
instance Show IdeGhcSession where show _ = "IdeGhcSession" | ||
instance NFData IdeGhcSession where rnf !_ = () | ||
|
||
data IdeOptions = IdeOptions | ||
{ optPreprocessor :: GHC.ParsedSource -> IdePreprocessedSource | ||
-- ^ Preprocessor to run over all parsed source trees, generating a list of warnings | ||
|
@@ -85,6 +76,8 @@ data IdeOptions = IdeOptions | |
-- ^ Will be called right after setting up a new cradle, | ||
-- allowing to customize the Ghc options used | ||
, optShakeOptions :: ShakeOptions | ||
, optSkipProgress :: forall a. Typeable a => a -> Bool | ||
-- ^ Predicate to select which rule keys to exclude from progress reporting. | ||
} | ||
|
||
optShakeFiles :: IdeOptions -> Maybe FilePath | ||
|
@@ -137,8 +130,21 @@ defaultIdeOptions session = IdeOptions | |
,optCheckParents = pure CheckOnSaveAndClose | ||
,optHaddockParse = HaddockParse | ||
,optCustomDynFlags = id | ||
,optSkipProgress = defaultSkipProgress | ||
} | ||
|
||
defaultSkipProgress :: Typeable a => a -> Bool | ||
defaultSkipProgress key = case () of | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could we comment as to why these nodes get excluded? The original reason for excluding GetFileExists was that given a module There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's performance, but I haven't measured. I'll add a comment or revert to just There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think is unreasonable - its a commonly called thing that is mostly irrelevant for performance concerns. I do think its important to say that |
||
-- don't do progress for GetFileContents as it's cheap | ||
_ | Just GetFileContents <- cast key -> True | ||
-- don't do progress for GetFileExists, as there are lots of redundant nodes | ||
-- (normally there is one node per file, but this is not the case for GetFileExists) | ||
_ | Just GetFileExists <- cast key -> True | ||
-- don't do progress for GetModificationTime as there are lot of redundant nodes | ||
-- (for the interface files) | ||
_ | Just GetModificationTime_{} <- cast key -> True | ||
_ -> False | ||
|
||
|
||
-- | The set of options used to locate files belonging to external packages. | ||
data IdePkgLocationOptions = IdePkgLocationOptions | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did this
#if
disappear? Seems unrelated.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doh, again! It's the second time it happens to me, I think this could be a problem with the pre-commit hook, /cc @Ailrun
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could be... It's probably because CPP support for the formatter is not so reliable. Unfortunately, I don't know any formatter that works well with CPP...