-
-
Notifications
You must be signed in to change notification settings - Fork 391
Improve hlint cpp support using the preprocessed buffer #1281
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
jneira
commented
Jan 31, 2021
- As suggested by @ndmitchell here
- It enables hlint suggestions for files with cpp conditions and ghc < 8.10
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.
Awesome - looks good to me.
After doing a manual test i've found that the code span of the hlint diagnostics using the preprocessed buffer doesnt match the real file. That was not tested and it should be cause i suspected it could be happen: #554 (comment) @ndmitchell i understood from your comment that the code spans would be honoured in the preprocessed but it seems that if it is not the case afaics. To make it work we should recover the original source spans from the preprocessed one to correct the diagnostic and not sure if it will worth (over other alternatives like extract cpp flags from the ghc session and pass them to hlint) 😟 |
What should happen is the preprocessor should drop |
Mmm, i've kept the hspp intermediate file with being .\ApplyRefact2.hs module ApplyRefact2 where
#include "test.h"
#ifdef TEST
f = (1)
#else
f = 1
#endif And the file in the line 215 of
Not sure if lines should be there |
OK, so GHC is dropping the (And sorry for taking so long to respond, I'm miles deep in a pile of emails) |
dont have time to continue working on this, feel free to reuse it |