Closed tfausak closed 4 years ago
Instead of aggressively removing all warnings when the user saves a file, perhaps a better thing to do is only clear out that file's warnings when GHCi starts compiling it. GHCi emits diagnostics like this:
2020-03-16T15:10:42.382Z [ghci/stdout] {"span": null,"doc": "[2 of 2] Compiling B ( /tmp/tmp.C0JEXgMio9/lib/B.hs, nothing )","severity": "SevOutput","reason": null}
Unfortunately plucking the file name out of there would require some parsing.
It's possible I'll need to revisit the "parser" that plucks the file name out of GHCi's messages. I'm not really sure what the format is.
Warnings from modules "lower" in the hierarchy can be hidden when you make changes to modules "higher" in the hierarchy. This happens because Purple Yolk clears out all errors when the user saves a file. GHCi only emits warnings from modules that it reloads. That means if a module doesn't need to be reloaded, its warnings won't show up.
As a concrete example, imagine you have a simple package with two modules:
A
andB
.A
has warnings.B
importsA
. If you saveA
, you'll get its warnings. But as soon as you saveB
,A
's warnings will go away. If you go back and saveA
, you'll get its warnings again.This is clearly a bug. It makes it hard to work with warnings in large projects because you can't be sure if the warning was fixed or if it's just not showing up right now.
One way to work around this problem is to enable
-Werror
, but that's not satisfying in general. Purple Yolk should be able to track all the warnings without having to give up on the first one.