@@ -15,6 +15,29 @@ import Development.IDE.GHC.Error
15
15
import Development.IDE.Types.Diagnostics
16
16
import Language.LSP.Protocol.Types (type (|? ) (.. ))
17
17
18
+ {-
19
+ NOTE on withWarnings and its dangers
20
+
21
+ withWarnings collects warnings by registering a custom logger which extracts
22
+ the SDocs of those warnings. If you receive warnings this way, you will not
23
+ get them in a structured form. In the medium term we'd like to remove all
24
+ uses of withWarnings to get structured messages everywhere we can.
25
+
26
+ For the time being, withWarnings is no longer used for anything in the main
27
+ typecheckModule codepath, but it is still used for bytecode/object code
28
+ generation, as well as a few other places.
29
+
30
+ I suspect some of these functions (e.g. codegen) will need deeper changes to
31
+ be able to get diagnostics as a list, though I don't have great evidence for
32
+ that atm. I haven't taken a look to see if those functions that are wrapped
33
+ with this could produce diagnostics another way.
34
+
35
+ It would be good for someone to take a look. What we've done so far gives us
36
+ diagnostics for renaming and typechecking, and doesn't require us to copy
37
+ too much code from GHC or make any deeper changes, and lets us get started
38
+ with the bulk of the useful plugin work, but it would be good to have all
39
+ diagnostics with structure be collected that way.
40
+ -}
18
41
19
42
-- | Take a GHC monadic action (e.g. @typecheckModule pm@ for some
20
43
-- parsed module 'pm@') and produce a "decorated" action that will
0 commit comments