erlide_eclipse
erlide_eclipse copied to clipboard
Would be nice if compilation errors/warnings could pinpoint the exact word
Compilation errors/warnings are today highlighted in the left margin. Would be nice if the exact word causing the compilation error/warning could be highlighted somehow as well.
Something like this

Yes, I agree. But at the moment the compiler only returns the line number. In some cases, it's possible to guess the location, but not in all of them. I'll try to get OTP to do something about it :wink:
In below case wouldn't it be possible to use the compiler error message "variable 'C' is unbound"?

Yes, this is one of the easy cases. I will look into it - to see how many cases we can handle without compiler support and how much work would that be.
Please, please, please, please, with sugar on top, help me to implement Clang-like diagnostics in the compiler. This will allow us to have a proper fix-it hint machinery and you people will be able to steal code from Clang support in Eclipse, if there is any. Anyone in it with me?
I can try to help you with that, Anthony. Do you have a branch for this? Let's discuss there.
The first step for Clang-like diagnostics is to have column numbers in compile errors, this is already done in my branch compile-column-numbers. This branch also introduce a new file attribute for tokens and trees, which has been submitted upstream separately because it improves the cleanliness of the code on its own anyway (erlang/otp#333). Three other small fixes were also submitted upstream already (erlang/otp#334, erlang/otp#336, erlang/otp#338).
Then, to have ranges of characters highlighted correctly, the scanner first has to be taught to remember range locations (i.e. {Line,Column} of both start and end of token) of every token (erl_scan-range) and the parser too (erl_parse-range). The latter branch is experimental and requires testing and documentation.
For the output, epp has to be able to spit back lines from the files it preprocessed, that is done in my branch (epp-read-lines). This is experimental and requires testing and documentation.
For macros, epp should be able to put in each token's attributes the macros from which the token was expanded, if any. Nothing has been done for this yet.
Finally, for proper diagnostics of syntax errors, erl_parse will need to be rewritten, probably by hand as other compilers with better diagnostics, like GCC, Clang or rustc. And obviously, plumbing everything together.