Skip to content

Commit d5b70e0

Browse files
committed
Change FileDiagnostic type synonym to a datatype
1 parent cebd641 commit d5b70e0

File tree

10 files changed

+80
-57
lines changed

10 files changed

+80
-57
lines changed

ghcide/session-loader/Development/IDE/Session.hs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -599,7 +599,7 @@ loadSessionWithOptions recorder SessionLoadingOptions{..} rootDir que = do
599599
this_target_details = TargetDetails (TargetFile _cfp) this_error_env this_dep_info [_cfp]
600600
this_flags = (this_error_env, this_dep_info)
601601
this_error_env = ([this_error], Nothing)
602-
this_error = ideErrorWithSource (Just "cradle") (Just DiagnosticSeverity_Error) _cfp
602+
this_error = uncurry (FileDiagnostic _cfp) $ ideErrorWithSource (Just "cradle") (Just DiagnosticSeverity_Error)
603603
$ T.unlines
604604
[ "No cradle target found. Is this file listed in the targets of your cradle?"
605605
, "If you are using a .cabal file, please ensure that this module is listed in either the exposed-modules or other-modules section"
@@ -923,7 +923,7 @@ newComponentCache recorder exts cradlePath _cfp hsc_env old_cis new_cis dir = do
923923

924924
#if MIN_VERSION_ghc(9,3,0)
925925
let closure_errs = checkHomeUnitsClosed' (hsc_unit_env hscEnv') (hsc_all_home_unit_ids hscEnv')
926-
multi_errs = map (ideErrorWithSource (Just "cradle") (Just DiagnosticSeverity_Warning) _cfp . T.pack . Compat.printWithoutUniques) closure_errs
926+
multi_errs = map (uncurry (FileDiagnostic _cfp) . ideErrorWithSource (Just "cradle") (Just DiagnosticSeverity_Warning) . T.pack . Compat.printWithoutUniques) closure_errs
927927
bad_units = OS.fromList $ concat $ do
928928
x <- bagToList $ mapBag errMsgDiagnostic $ unionManyBags $ map Compat.getMessages closure_errs
929929
DriverHomePackagesNotClosed us <- pure x
@@ -1309,6 +1309,8 @@ showPackageSetupException PackageSetupException{..} = unwords
13091309
, "failed to load packages:", message <> "."
13101310
, "\nPlease ensure that ghcide is compiled with the same GHC installation as the project."]
13111311

1312-
renderPackageSetupException :: FilePath -> PackageSetupException -> (NormalizedFilePath, ShowDiagnostic, Diagnostic)
1312+
renderPackageSetupException :: FilePath -> PackageSetupException -> FileDiagnostic
13131313
renderPackageSetupException fp e =
1314-
ideErrorWithSource (Just "cradle") (Just DiagnosticSeverity_Error) (toNormalizedFilePath' fp) (T.pack $ showPackageSetupException e)
1314+
let (showDiag, lspDiag) = ideErrorWithSource (Just "cradle") (Just DiagnosticSeverity_Error) (T.pack $ showPackageSetupException e)
1315+
in
1316+
FileDiagnostic (toNormalizedFilePath' fp) showDiag lspDiag

ghcide/session-loader/Development/IDE/Session/Diagnostics.hs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,11 @@ data CradleErrorDetails =
2929
renderCradleError :: CradleError -> Cradle a -> NormalizedFilePath -> FileDiagnostic
3030
renderCradleError (CradleError deps _ec ms) cradle nfp
3131
| HieBios.isCabalCradle cradle =
32-
let (fp, showDiag, diag) = ideErrorWithSource (Just "cradle") (Just DiagnosticSeverity_Error) nfp $ T.unlines $ map T.pack userFriendlyMessage in
33-
(fp, showDiag, diag{_data_ = Just $ Aeson.toJSON CradleErrorDetails{cabalProjectFiles=absDeps}})
34-
| otherwise = ideErrorWithSource (Just "cradle") (Just DiagnosticSeverity_Error) nfp $ T.unlines $ map T.pack userFriendlyMessage
32+
let (showDiag, diag) = ideErrorWithSource (Just "cradle") (Just DiagnosticSeverity_Error) $ T.unlines $ map T.pack userFriendlyMessage
33+
in FileDiagnostic nfp showDiag diag{_data_ = Just $ Aeson.toJSON CradleErrorDetails{cabalProjectFiles=absDeps}}
34+
| otherwise =
35+
let (showDiag, diag) = ideErrorWithSource (Just "cradle") (Just DiagnosticSeverity_Error) $ T.unlines $ map T.pack userFriendlyMessage
36+
in FileDiagnostic nfp showDiag diag
3537
where
3638
absDeps = fmap (cradleRootDir cradle </>) deps
3739
userFriendlyMessage :: [String]

ghcide/src/Development/IDE/Core/Compile.hs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -739,20 +739,20 @@ unDefer (Reason Opt_WarnDeferredOutOfScopeVariables, fd) = (True, upgradeWarning
739739
unDefer ( _ , fd) = (False, fd)
740740

741741
upgradeWarningToError :: FileDiagnostic -> FileDiagnostic
742-
upgradeWarningToError (nfp, sh, fd) =
743-
(nfp, sh, fd{_severity = Just DiagnosticSeverity_Error, _message = warn2err $ _message fd}) where
742+
upgradeWarningToError fd =
743+
modifyFdLspDiagnostic (\diag -> diag {_severity = Just DiagnosticSeverity_Error, _message = warn2err $ _message diag}) fd where
744744
warn2err :: T.Text -> T.Text
745745
warn2err = T.intercalate ": error:" . T.splitOn ": warning:"
746746

747747
#if MIN_VERSION_ghc(9,3,0)
748748
hideDiag :: DynFlags -> (Maybe DiagnosticReason, FileDiagnostic) -> (Maybe DiagnosticReason, FileDiagnostic)
749-
hideDiag originalFlags (w@(Just (WarningWithFlag warning)), (nfp, _sh, fd))
749+
hideDiag originalFlags (w@(Just (WarningWithFlag warning)), fd)
750750
#else
751751
hideDiag :: DynFlags -> (WarnReason, FileDiagnostic) -> (WarnReason, FileDiagnostic)
752-
hideDiag originalFlags (w@(Reason warning), (nfp, _sh, fd))
752+
hideDiag originalFlags (w@(Reason warning), fd)
753753
#endif
754754
| not (wopt warning originalFlags)
755-
= (w, (nfp, HideDiag, fd))
755+
= (w, fd { fdShouldShowDiagnostic = HideDiag })
756756
hideDiag _originalFlags t = t
757757

758758
-- | Warnings which lead to a diagnostic tag
@@ -780,20 +780,20 @@ tagDiag :: (WarnReason, FileDiagnostic) -> (WarnReason, FileDiagnostic)
780780
#endif
781781

782782
#if MIN_VERSION_ghc(9,7,0)
783-
tagDiag (w@(Just (WarningWithCategory cat)), (nfp, sh, fd))
783+
tagDiag (w@(Just (WarningWithCategory cat)), fd)
784784
| cat == defaultWarningCategory -- default warning category is for deprecations
785-
= (w, (nfp, sh, fd { _tags = Just $ DiagnosticTag_Deprecated : concat (_tags fd) }))
786-
tagDiag (w@(Just (WarningWithFlags warnings)), (nfp, sh, fd))
785+
= (w, modifyFdLspDiagnostic (\diag -> diag { _tags = Just $ DiagnosticTag_Deprecated : concat (_tags diag) }) fd)
786+
tagDiag (w@(Just (WarningWithFlags warnings)), fd)
787787
| tags <- mapMaybe requiresTag (toList warnings)
788-
= (w, (nfp, sh, fd { _tags = Just $ tags ++ concat (_tags fd) }))
788+
= (w, modifyFdLspDiagnostic (\diag -> diag { _tags = Just $ tags ++ concat (_tags diag) }) fd)
789789
#elif MIN_VERSION_ghc(9,3,0)
790-
tagDiag (w@(Just (WarningWithFlag warning)), (nfp, sh, fd))
790+
tagDiag (w@(Just (WarningWithFlag warning)), fd)
791791
| Just tag <- requiresTag warning
792-
= (w, (nfp, sh, fd { _tags = Just $ tag : concat (_tags fd) }))
792+
= (w, modifyFdLspDiagnostic (\diag -> diag { _tags = Just $ tag : concat (_tags diag) }) fd)
793793
#else
794-
tagDiag (w@(Reason warning), (nfp, sh, fd))
794+
tagDiag (w@(Reason warning), fd)
795795
| Just tag <- requiresTag warning
796-
= (w, (nfp, sh, fd { _tags = Just $ tag : concat (_tags fd) }))
796+
= (w, modifyFdLspDiagnostic (\diag -> { _tags = Just $ tag : concat (_tags diag) }) fd)
797797
#endif
798798
where
799799
requiresTag :: WarningFlag -> Maybe DiagnosticTag

ghcide/src/Development/IDE/Core/Preprocessor.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ data CPPDiag
112112

113113
diagsFromCPPLogs :: FilePath -> [CPPLog] -> [FileDiagnostic]
114114
diagsFromCPPLogs filename logs =
115-
map (\d -> (toNormalizedFilePath' filename, ShowDiag, cppDiagToDiagnostic d)) $
115+
map (\d -> FileDiagnostic (toNormalizedFilePath' filename) ShowDiag (cppDiagToDiagnostic d)) $
116116
go [] logs
117117
where
118118
-- On errors, CPP calls logAction with a real span for the initial log and

ghcide/src/Development/IDE/Core/Rules.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,7 @@ reportImportCyclesRule recorder =
501501
where cycleErrorInFile f (PartOfCycle imp fs)
502502
| f `elem` fs = Just (imp, fs)
503503
cycleErrorInFile _ _ = Nothing
504-
toDiag imp mods = (fp , ShowDiag , ) $ Diagnostic
504+
toDiag imp mods = FileDiagnostic fp ShowDiag $ Diagnostic
505505
{ _range = rng
506506
, _severity = Just DiagnosticSeverity_Error
507507
, _source = Just "Import cycle detection"

ghcide/src/Development/IDE/Core/Shake.hs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1192,7 +1192,7 @@ defineEarlyCutoff recorder (Rule op) = addRule $ \(Q (key, file)) (old :: Maybe
11921192
extras <- getShakeExtras
11931193
let diagnostics ver diags = do
11941194
traceDiagnostics diags
1195-
updateFileDiagnostics recorder file ver (newKey key) extras . map (\(_,y,z) -> (y,z)) $ diags
1195+
updateFileDiagnostics recorder file ver (newKey key) extras diags
11961196
defineEarlyCutoff' diagnostics (==) key file old mode $ const $ op key file
11971197
defineEarlyCutoff recorder (RuleNoDiagnostics op) = addRule $ \(Q (key, file)) (old :: Maybe BS.ByteString) mode -> otTracedAction key file mode traceA $ \traceDiagnostics -> do
11981198
let diagnostics _ver diags = do
@@ -1211,7 +1211,7 @@ defineEarlyCutoff recorder (RuleWithOldValue op) = addRule $ \(Q (key, file)) (o
12111211
extras <- getShakeExtras
12121212
let diagnostics ver diags = do
12131213
traceDiagnostics diags
1214-
updateFileDiagnostics recorder file ver (newKey key) extras . map (\(_,y,z) -> (y,z)) $ diags
1214+
updateFileDiagnostics recorder file ver (newKey key) extras diags
12151215
defineEarlyCutoff' diagnostics (==) key file old mode $ op key file
12161216

12171217
defineNoFile :: IdeRule k v => Recorder (WithPriority Log) -> (k -> Action v) -> Rules ()
@@ -1347,34 +1347,34 @@ updateFileDiagnostics :: MonadIO m
13471347
-> Maybe Int32
13481348
-> Key
13491349
-> ShakeExtras
1350-
-> [(ShowDiagnostic,Diagnostic)] -- ^ current results
1350+
-> [FileDiagnostic] -- ^ current results
13511351
-> m ()
13521352
updateFileDiagnostics recorder fp ver k ShakeExtras{diagnostics, hiddenDiagnostics, publishedDiagnostics, debouncer, lspEnv, ideTesting} current0 =
13531353
liftIO $ withTrace ("update diagnostics " <> fromString(fromNormalizedFilePath fp)) $ \ addTag -> do
13541354
addTag "key" (show k)
1355-
let (currentShown, currentHidden) = partition ((== ShowDiag) . fst) current
1355+
let (currentShown, currentHidden) = partition ((== ShowDiag) . fdShouldShowDiagnostic) current
13561356
uri = filePathToUri' fp
13571357
addTagUnsafe :: String -> String -> String -> a -> a
13581358
addTagUnsafe msg t x v = unsafePerformIO(addTag (msg <> t) x) `seq` v
13591359
update :: (forall a. String -> String -> a -> a) -> [Diagnostic] -> STMDiagnosticStore -> STM [Diagnostic]
13601360
update addTagUnsafeMethod new store = addTagUnsafeMethod "count" (show $ Prelude.length new) $ setStageDiagnostics addTagUnsafeMethod uri ver (renderKey k) new store
1361-
current = second diagsFromRule <$> current0
1361+
current = map (modifyFdLspDiagnostic diagsFromRule) current0
13621362
addTag "version" (show ver)
13631363
mask_ $ do
13641364
-- Mask async exceptions to ensure that updated diagnostics are always
13651365
-- published. Otherwise, we might never publish certain diagnostics if
13661366
-- an exception strikes between modifyVar but before
13671367
-- publishDiagnosticsNotification.
1368-
newDiags <- liftIO $ atomicallyNamed "diagnostics - update" $ update (addTagUnsafe "shown ") (map snd currentShown) diagnostics
1369-
_ <- liftIO $ atomicallyNamed "diagnostics - hidden" $ update (addTagUnsafe "hidden ") (map snd currentHidden) hiddenDiagnostics
1368+
newDiags <- liftIO $ atomicallyNamed "diagnostics - update" $ update (addTagUnsafe "shown ") (map fdLspDiagnostic currentShown) diagnostics
1369+
_ <- liftIO $ atomicallyNamed "diagnostics - hidden" $ update (addTagUnsafe "hidden ") (map fdLspDiagnostic currentHidden) hiddenDiagnostics
13701370
let uri' = filePathToUri' fp
13711371
let delay = if null newDiags then 0.1 else 0
13721372
registerEvent debouncer delay uri' $ withTrace ("report diagnostics " <> fromString (fromNormalizedFilePath fp)) $ \tag -> do
13731373
join $ mask_ $ do
13741374
lastPublish <- atomicallyNamed "diagnostics - publish" $ STM.focus (Focus.lookupWithDefault [] <* Focus.insert newDiags) uri' publishedDiagnostics
13751375
let action = when (lastPublish /= newDiags) $ case lspEnv of
13761376
Nothing -> -- Print an LSP event.
1377-
logWith recorder Info $ LogDiagsDiffButNoLspEnv (map (fp, ShowDiag,) newDiags)
1377+
logWith recorder Info $ LogDiagsDiffButNoLspEnv (map (FileDiagnostic fp ShowDiag) newDiags)
13781378
Just env -> LSP.runLspT env $ do
13791379
liftIO $ tag "count" (show $ Prelude.length newDiags)
13801380
liftIO $ tag "key" (show k)
@@ -1442,7 +1442,7 @@ getAllDiagnostics ::
14421442
STMDiagnosticStore ->
14431443
STM [FileDiagnostic]
14441444
getAllDiagnostics =
1445-
fmap (concatMap (\(k,v) -> map (fromUri k,ShowDiag,) $ getDiagnosticsFromStore v)) . ListT.toList . STM.listT
1445+
fmap (concatMap (\(k,v) -> map (FileDiagnostic (fromUri k) ShowDiag) $ getDiagnosticsFromStore v)) . ListT.toList . STM.listT
14461446

14471447
updatePositionMapping :: IdeState -> VersionedTextDocumentIdentifier -> [TextDocumentContentChangeEvent] -> STM ()
14481448
updatePositionMapping IdeState{shakeExtras = ShakeExtras{positionMapping}} VersionedTextDocumentIdentifier{..} changes =

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

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -52,17 +52,22 @@ import Language.LSP.VFS (CodePointPosition (CodePoint
5252

5353

5454
diagFromText :: T.Text -> D.DiagnosticSeverity -> SrcSpan -> T.Text -> FileDiagnostic
55-
diagFromText diagSource sev loc msg = (toNormalizedFilePath' $ fromMaybe noFilePath $ srcSpanToFilename loc,ShowDiag,)
56-
Diagnostic
57-
{ _range = fromMaybe noRange $ srcSpanToRange loc
58-
, _severity = Just sev
59-
, _source = Just diagSource -- not shown in the IDE, but useful for ghcide developers
60-
, _message = msg
61-
, _code = Nothing
62-
, _relatedInformation = Nothing
63-
, _tags = Nothing
64-
, _codeDescription = Nothing
65-
, _data_ = Nothing
55+
diagFromText diagSource sev loc msg =
56+
FileDiagnostic
57+
{ fdFilePath = toNormalizedFilePath' $ fromMaybe noFilePath $ srcSpanToFilename loc
58+
, fdShouldShowDiagnostic = ShowDiag
59+
, fdLspDiagnostic =
60+
Diagnostic
61+
{ _range = fromMaybe noRange $ srcSpanToRange loc
62+
, _severity = Just sev
63+
, _source = Just diagSource -- not shown in the IDE, but useful for ghcide developers
64+
, _message = msg
65+
, _code = Nothing
66+
, _relatedInformation = Nothing
67+
, _tags = Nothing
68+
, _codeDescription = Nothing
69+
, _data_ = Nothing
70+
}
6671
}
6772

6873
-- | Produce a GHC-style error from a source span and a message.

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

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,12 @@ withWarnings diagSource action = do
3333
warnings <- newVar []
3434
let newAction :: DynFlags -> LogActionCompat
3535
newAction dynFlags logFlags wr _ loc prUnqual msg = do
36-
let wr_d = map ((wr,) . third3 (attachReason wr)) $ diagFromErrMsg diagSource dynFlags $ mkWarnMsg dynFlags wr logFlags loc prUnqual msg
36+
let wr_d = map ((wr,) . modifyFdLspDiagnostic (attachReason wr)) $ diagFromErrMsg diagSource dynFlags $ mkWarnMsg dynFlags wr logFlags loc prUnqual msg
3737
modifyVar_ warnings $ return . (wr_d:)
3838
newLogger env = pushLogHook (const (logActionCompat (newAction (hsc_dflags env)))) (hsc_logger env)
3939
res <- action $ \env -> putLogHook (newLogger env) env
4040
warns <- readVar warnings
4141
return (reverse $ concat warns, res)
42-
where
43-
third3 :: (c -> d) -> (a, b, c) -> (a, b, d)
44-
third3 f (a, b, c) = (a, b, f c)
4542

4643
#if MIN_VERSION_ghc(9,3,0)
4744
attachReason :: Maybe DiagnosticReason -> Diagnostic -> Diagnostic

ghcide/src/Development/IDE/Plugin/TypeLenses.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import Development.IDE (GhcSession (..),
3030
HscEnvEq (hscEnv),
3131
RuleResult, Rules, Uri,
3232
define, srcSpanToRange,
33-
usePropertyAction)
33+
usePropertyAction, FileDiagnostic (..))
3434
import Development.IDE.Core.Compile (TcModuleResult (..))
3535
import Development.IDE.Core.PluginUtils
3636
import Development.IDE.Core.PositionMapping (PositionMapping,
@@ -126,7 +126,7 @@ codeLensProvider ideState pId CodeLensParams{_textDocument = TextDocumentIdentif
126126
-- We don't actually pass any data to resolve, however we need this
127127
-- dummy type to make sure HLS resolves our lens
128128
[ CodeLens _range Nothing (Just $ toJSON TypeLensesResolve)
129-
| (dFile, _, diag@Diagnostic{_range}) <- diags
129+
| FileDiagnostic dFile _ diag@Diagnostic{_range} <- diags
130130
, dFile == nfp
131131
, isGlobalDiagnostic diag]
132132
-- The second option is to generate lenses from the GlobalBindingTypeSig

ghcide/src/Development/IDE/Types/Diagnostics.hs

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
-- Copyright (c) 2019 The DAML Authors. All rights reserved.
22
-- SPDX-License-Identifier: Apache-2.0
33

4+
{-# LANGUAGE DeriveGeneric #-}
45

56
module Development.IDE.Types.Diagnostics (
67
LSP.Diagnostic(..),
78
ShowDiagnostic(..),
8-
FileDiagnostic,
9+
FileDiagnostic(..),
10+
modifyFdLspDiagnostic,
911
IdeResult,
1012
LSP.DiagnosticSeverity(..),
1113
DiagnosticStore,
@@ -20,6 +22,7 @@ import Data.ByteString (ByteString)
2022
import Data.Maybe as Maybe
2123
import qualified Data.Text as T
2224
import Development.IDE.Types.Location
25+
import GHC.Generics
2326
import Language.LSP.Diagnostics
2427
import Language.LSP.Protocol.Types as LSP (Diagnostic (..),
2528
DiagnosticSeverity (..))
@@ -45,15 +48,18 @@ type IdeResult v = ([FileDiagnostic], Maybe v)
4548
type IdeResultNoDiagnosticsEarlyCutoff v = (Maybe ByteString, Maybe v)
4649

4750
ideErrorText :: NormalizedFilePath -> T.Text -> FileDiagnostic
48-
ideErrorText = ideErrorWithSource (Just "compiler") (Just DiagnosticSeverity_Error)
51+
ideErrorText fdFilePath msg =
52+
let (fdShouldShowDiagnostic, fdLspDiagnostic) =
53+
ideErrorWithSource (Just "compiler") (Just DiagnosticSeverity_Error) msg
54+
in
55+
FileDiagnostic{..}
4956

5057
ideErrorWithSource
5158
:: Maybe T.Text
5259
-> Maybe DiagnosticSeverity
53-
-> a
5460
-> T.Text
55-
-> (a, ShowDiagnostic, Diagnostic)
56-
ideErrorWithSource source sev fp msg = (fp, ShowDiag, LSP.Diagnostic {
61+
-> (ShowDiagnostic, Diagnostic)
62+
ideErrorWithSource source sev msg = (ShowDiag, LSP.Diagnostic {
5763
_range = noRange,
5864
_severity = sev,
5965
_code = Nothing,
@@ -86,7 +92,18 @@ instance NFData ShowDiagnostic where
8692
-- along with the related source location so that we can display the error
8793
-- on either the console or in the IDE at the right source location.
8894
--
89-
type FileDiagnostic = (NormalizedFilePath, ShowDiagnostic, Diagnostic)
95+
data FileDiagnostic = FileDiagnostic
96+
{ fdFilePath :: NormalizedFilePath
97+
, fdShouldShowDiagnostic :: ShowDiagnostic
98+
, fdLspDiagnostic :: Diagnostic
99+
}
100+
deriving (Eq, Ord, Show, Generic)
101+
102+
instance NFData FileDiagnostic
103+
104+
modifyFdLspDiagnostic :: (Diagnostic -> Diagnostic) -> FileDiagnostic -> FileDiagnostic
105+
modifyFdLspDiagnostic f diag =
106+
diag { fdLspDiagnostic = f (fdLspDiagnostic diag) }
90107

91108
prettyRange :: Range -> Doc Terminal.AnsiStyle
92109
prettyRange Range{..} = f _start <> "-" <> f _end
@@ -106,10 +123,10 @@ prettyDiagnostics :: [FileDiagnostic] -> Doc Terminal.AnsiStyle
106123
prettyDiagnostics = vcat . map prettyDiagnostic
107124

108125
prettyDiagnostic :: FileDiagnostic -> Doc Terminal.AnsiStyle
109-
prettyDiagnostic (fp, sh, LSP.Diagnostic{..}) =
126+
prettyDiagnostic FileDiagnostic { fdFilePath, fdShouldShowDiagnostic, fdLspDiagnostic = LSP.Diagnostic{..} } =
110127
vcat
111-
[ slabel_ "File: " $ pretty (fromNormalizedFilePath fp)
112-
, slabel_ "Hidden: " $ if sh == ShowDiag then "no" else "yes"
128+
[ slabel_ "File: " $ pretty (fromNormalizedFilePath fdFilePath)
129+
, slabel_ "Hidden: " $ if fdShouldShowDiagnostic == ShowDiag then "no" else "yes"
113130
, slabel_ "Range: " $ prettyRange _range
114131
, slabel_ "Source: " $ pretty _source
115132
, slabel_ "Severity:" $ pretty $ show sev

0 commit comments

Comments
 (0)