-
Notifications
You must be signed in to change notification settings - Fork 97
#573, make haddock errors warnings with the word Haddock in front #608
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's probably more changes needed to handle Haddock errors in dependencies, see:
https://github.com/digital-asset/ghcide/blob/master/src/Development/IDE/Core/Rules.hs#L632-L635
src/Development/IDE/Core/Rules.hs
Outdated
|
||
((fingerPrint, (diags, res)), diagsHaddock) <- | ||
-- parse twice, with and without Haddocks, concurrently | ||
-- we cannot ignore Haddock parse errors because files of | ||
-- non-interest are always parsed with Haddocks | ||
liftIO $ concurrently mainParse haddockParse | ||
|
||
return (fingerPrint, (mergeDiagnostics diags diagsHaddock, res)) | ||
-- if you have a Haddock warning and a real warning at the same exact location, throw away the Haddock one |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need this special logic? I would think that a comment can only have Haddock warnings
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We run the parser twice. If you have (
as your source file, it will be a parse error with both Haddock and without, so you'll get the same error twice. This dedupe ensures you only get the warning once.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so the comment is a bit misleading, it's only non Haddock warnings that need deduping, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment updated. Is that clearer?
I've had much more issues with haddock warnings in files of interest because I just typed |
I would think so, yes, and the solution is similar - parse again without |
It feels odd that we have two locations where we do a parse with haddock/parse without dance, and in one we use concurrently, and in one we don't. We should probably do the same thing in both cases. My guess is "the right thing" is to parse with Haddock, and if there are no errors, continue on. If there were errors, parse again without Haddock, and turn all errors that came from Haddock only into warnings. For files with parse errors it's slightly more latency, but the latency on a parse error is pretty low already, so that isn't a massive problem. @pepeiborra if that makes sense to you, I'll try that. |
The reason we don't parse with |
OK, I'll try figuring out some sane abstractions to handle that mess. |
Adding a bit more context here: GHC has |
So we still have two different behaviours. For |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Version 0.2.0 was hitting issues that have since been fixed by haskell/ghcide#608
…k in front (haskell/ghcide#608) * haskell/ghcide#573, make haddock errors warnings with the word Haddock in front * Update Rules.hs * Deal with Haddock failures in getModIfaceRule
…k in front (haskell/ghcide#608) * haskell/ghcide#573, make haddock errors warnings with the word Haddock in front * Update Rules.hs * Deal with Haddock failures in getModIfaceRule
…k in front (haskell/ghcide#608) * haskell/ghcide#573, make haddock errors warnings with the word Haddock in front * Update Rules.hs * Deal with Haddock failures in getModIfaceRule
Fixes #573. Downgrade Haddock errors to warnings, and prepend Haddock in front of them. Now we are manipulating Haddock warnings, its easier to dedupe them by range than trying to merge arbitrary diagnostics.