tfausak / purple-yolk

:hatching_chick: A Haskell IDE for Visual Studio Code.
https://marketplace.visualstudio.com/items?itemName=taylorfausak.purple-yolk
MIT License
26 stars 2 forks source link

Warnings can be hidden when saving files #8

Closed tfausak closed 4 years ago

tfausak commented 4 years ago

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 and B. A has warnings. B imports A. If you save A, you'll get its warnings. But as soon as you save B, A's warnings will go away. If you go back and save A, 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.

tfausak commented 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.

tfausak commented 4 years ago

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.