Skip to content

Commit 51dd324

Browse files
committed
Restore more hints in diagnostic messages
1 parent a5c7a1e commit 51dd324

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

ghcide/src/Development/IDE/GHC/Compat.hs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -413,11 +413,6 @@ getMessages' pst dflags =
413413
#endif
414414
#endif
415415

416-
#if MIN_VERSION_ghc(9,3,0)
417-
renderDiagnosticMessageWithHints :: Diagnostic a => a -> DecoratedSDoc
418-
renderDiagnosticMessageWithHints a = unionDecoratedSDoc (diagnosticMessage a) (mkDecorated $ map ppr $ diagnosticHints a)
419-
#endif
420-
421416
#if MIN_VERSION_ghc(9,2,0)
422417
pattern PFailedWithErrorMessages :: forall a b. (b -> Bag (MsgEnvelope DecoratedSDoc)) -> ParseResult a
423418
pattern PFailedWithErrorMessages msgs

ghcide/src/Development/IDE/GHC/Compat/Outputable.hs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ module Development.IDE.GHC.Compat.Outputable (
1919
PsError,
2020
#if MIN_VERSION_ghc(9,3,0)
2121
DiagnosticReason(..),
22+
renderDiagnosticMessageWithHints,
2223
#else
2324
pprWarning,
2425
pprError,
@@ -201,9 +202,14 @@ mkPrintUnqualifiedDefault env =
201202
HscTypes.mkPrintUnqualified (hsc_dflags env)
202203
#endif
203204

205+
#if MIN_VERSION_ghc(9,3,0)
206+
renderDiagnosticMessageWithHints :: Diagnostic a => a -> DecoratedSDoc
207+
renderDiagnosticMessageWithHints a = Error.unionDecoratedSDoc (diagnosticMessage a) (mkDecorated $ map ppr $ diagnosticHints a)
208+
#endif
209+
204210
#if MIN_VERSION_ghc(9,3,0)
205211
mkWarnMsg :: DynFlags -> Maybe DiagnosticReason -> b -> SrcSpan -> PrintUnqualified -> SDoc -> MsgEnvelope DecoratedSDoc
206-
mkWarnMsg df reason _logFlags l st doc = fmap diagnosticMessage $ mkMsgEnvelope (initDiagOpts df) l st (mkPlainDiagnostic (fromMaybe WarningWithoutFlag reason) [] doc)
212+
mkWarnMsg df reason _logFlags l st doc = fmap renderDiagnosticMessageWithHints $ mkMsgEnvelope (initDiagOpts df) l st (mkPlainDiagnostic (fromMaybe WarningWithoutFlag reason) [] doc)
207213
#else
208214
mkWarnMsg :: a -> b -> DynFlags -> SrcSpan -> PrintUnqualified -> SDoc -> MsgEnvelope DecoratedSDoc
209215
mkWarnMsg _ _ =

0 commit comments

Comments
 (0)