Filter not-enabled warnings completely

I’ve tried out the new behavior added in #232 and it is extremely
noisy, in particular, the warnings enabled by
Opt_WarnMissingLocalSignatures which I don’t want to see. I think for
now it makes more sense to disable them completely. We still show the
codelenses which is somewhat on the edge but at least they don’t
clutter the problems tab/CLI output so I’m fine with keeping those
even if they are not enabled.
This commit is contained in:
Moritz Kiefer 2019-12-16 16:54:13 +01:00
parent 4440a26380
commit 44e8b9464b

View File

@ -108,14 +108,15 @@ typecheckModule (IdeDefer defer) packageState deps pm =
GHC.typecheckModule $ enableTopLevelWarnings
$ demoteIfDefer pm{pm_mod_summary = tweak modSummary'}
tcm2 <- mkTcModuleResult tcm
let errorPipeline = unDefer
. (if wopt Opt_WarnMissingSignatures dflags
then id
else degradeError Opt_WarnMissingSignatures)
. (if wopt Opt_WarnMissingLocalSignatures dflags
then id
else degradeError Opt_WarnMissingLocalSignatures)
return (map errorPipeline warnings, tcm2)
let errorPipeline =
fmap unDefer .
(if wopt Opt_WarnMissingSignatures dflags
then Just
else filterWarning Opt_WarnMissingSignatures) <=<
(if wopt Opt_WarnMissingLocalSignatures dflags
then Just
else filterWarning Opt_WarnMissingLocalSignatures)
return (mapMaybe errorPipeline warnings, tcm2)
initPlugins :: GhcMonad m => ModSummary -> m ModSummary
initPlugins modSummary = do
@ -197,10 +198,10 @@ unDefer (Reason Opt_WarnTypedHoles , fd) = upgradeWarningToError
unDefer (Reason Opt_WarnDeferredOutOfScopeVariables, fd) = upgradeWarningToError fd
unDefer ( _ , fd) = fd
degradeError :: WarningFlag -> (WarnReason, FileDiagnostic) -> (WarnReason, FileDiagnostic)
degradeError f (Reason f', fd)
| f == f' = (Reason f', degradeWarningToError fd)
degradeError _ wfd = wfd
filterWarning :: WarningFlag -> (WarnReason, FileDiagnostic) -> Maybe (WarnReason, FileDiagnostic)
filterWarning f (Reason f', _)
| f == f' = Nothing
filterWarning _ wfd = Just wfd
upgradeWarningToError :: FileDiagnostic -> FileDiagnostic
upgradeWarningToError (nfp, fd) =
@ -208,10 +209,6 @@ upgradeWarningToError (nfp, fd) =
warn2err :: T.Text -> T.Text
warn2err = T.intercalate ": error:" . T.splitOn ": warning:"
degradeWarningToError :: FileDiagnostic -> FileDiagnostic
degradeWarningToError (nfp, fd) =
(nfp, fd{_severity = Just DsInfo})
addRelativeImport :: NormalizedFilePath -> ParsedModule -> DynFlags -> DynFlags
addRelativeImport fp modu dflags = dflags
{importPaths = nubOrd $ maybeToList (moduleImportPath fp modu) ++ importPaths dflags}