Skip to content

Commit 0b04420

Browse files
committed
when testing: record the source rule in diagnostics
1 parent b1b11e6 commit 0b04420

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

Diff for: ghcide/src/Development/IDE/Core/Shake.hs

+7-1
Original file line numberDiff line numberDiff line change
@@ -1199,7 +1199,7 @@ updateFileDiagnostics :: MonadIO m
11991199
-> ShakeExtras
12001200
-> [(ShowDiagnostic,Diagnostic)] -- ^ current results
12011201
-> m ()
1202-
updateFileDiagnostics recorder fp ver k ShakeExtras{diagnostics, hiddenDiagnostics, publishedDiagnostics, debouncer, lspEnv} current =
1202+
updateFileDiagnostics recorder fp ver k ShakeExtras{diagnostics, hiddenDiagnostics, publishedDiagnostics, debouncer, lspEnv, ideTesting} current0 =
12031203
liftIO $ withTrace ("update diagnostics " <> fromString(fromNormalizedFilePath fp)) $ \ addTag -> do
12041204
addTag "key" (show k)
12051205
let (currentShown, currentHidden) = partition ((== ShowDiag) . fst) current
@@ -1208,6 +1208,7 @@ updateFileDiagnostics recorder fp ver k ShakeExtras{diagnostics, hiddenDiagnosti
12081208
addTagUnsafe msg t x v = unsafePerformIO(addTag (msg <> t) x) `seq` v
12091209
update :: (forall a. String -> String -> a -> a) -> [Diagnostic] -> STMDiagnosticStore -> STM [Diagnostic]
12101210
update addTagUnsafe new store = addTagUnsafe "count" (show $ Prelude.length new) $ setStageDiagnostics addTagUnsafe uri ver (T.pack $ show k) new store
1211+
current = second diagsFromRule <$> current0
12111212
addTag "version" (show ver)
12121213
mask_ $ do
12131214
-- Mask async exceptions to ensure that updated diagnostics are always
@@ -1230,6 +1231,11 @@ updateFileDiagnostics recorder fp ver k ShakeExtras{diagnostics, hiddenDiagnosti
12301231
LSP.sendNotification LSP.STextDocumentPublishDiagnostics $
12311232
LSP.PublishDiagnosticsParams (fromNormalizedUri uri) (fmap fromIntegral ver) (List newDiags)
12321233
return action
1234+
where
1235+
diagsFromRule c
1236+
| coerce ideTesting = c{_source = ((T.pack(show k) <> ":") <>) <$> _source c}
1237+
| otherwise = c
1238+
12331239

12341240
newtype Priority = Priority Double
12351241

0 commit comments

Comments
 (0)