When there are multiple errors with the same message on the same line, only one is added, even if they have different offsets.
This happens when one uses DefaultErrorSource.addError().
Attached a macro to reproduce this behaviour (encountered it while testing the SpellCheck plugin).
Attached a potential fix (take offsets into account when doing comparison). I think it doesn't interfere with LineKey...
a macro to demonstrate the problem
Logged In: YES
user_id=1725856
Originator: YES
Running this macro should show ErrorList containing only one error for the new buffer...
File Added: reproduce_bug.bsh
Logged In: YES
user_id=1486645
Originator: NO
I think this behavior hasn't been unintended.
While I can see, that You really need more than one error per line, it would be nice to keep the current behavior optional. More: If there were added several errors with *different* messages related to the same line of the same file, they could be merged into one error with extra messages...
Robert
Logged In: YES
user_id=1725856
Originator: YES
Why do you think that the less errors, the better ?
And what should one do to merge errors with already extra messages ?
However, the UI could group errors on the same line together in a sub-tree,
while retaining each error individually.
Cheers,
Eric
Logged In: YES
user_id=1486645
Originator: NO
Many users are willing to ignore error messages because they had to do something against ;-). And when they are flooded with errors they will ignore it.
If the merging feature would be implemented, it had to be optional of course and would be the choice of the programmer . So, I wouldn't apply any changes to the UI: simply add the next messages as extra messages - that's all.
Robert
Logged In: YES
user_id=1725856
Originator: YES
Indeed, getting many errors is annoying (something like 700 misspelled words in a file makes a depressing list).
On the other hand, clicking on an error in the error list selects the text in question. So this seems handy to go from one word to another. What do you think ?
Concerning the original issue of ignored errors, there is this tracker item:
http://sourceforge.net/tracker/index.php?func=detail&aid=1678767&group_id=588&atid=565475
It's then that the filtering feature was implemented, to prevent multiple identical errors to appear.
In the case of spell-checking, you can have twice the same word on the same line, resulting in two errors with the same message.
The words are however at different offsets, so the two errors are not identical.
What I propose is to take the offsets into account for comparison, so that redundant errors are dumped, but not different ones.
By the way, do you know any plugin which makes use of the offset-level for error-reporting, as maybe they encountered the same problem ?
Thanks for your feedback,
Eric
Logged In: YES
user_id=1483238
Originator: NO
Thank you for the patch. It's my bad not comparing offsets in
ErrorComparator.
There is one question. Why the comparison of getEndOffset() is flipped?
The comment says "smaller one first" but I think the smaller word(?) has
also smaller end offset. Thus the comparison should be same with that
for getStartOffset(), shouldn't it?
I'm happy if you also update the comments for ErrorComparator and
ErrorListForPath.
patch against ErrorList/trunk@r13011 added comments and fixed end offsets comparison
Logged In: YES
user_id=1725856
Originator: YES
Indeed, I mixed it up...
Please find the new patch attached.
Cheers,
File Added: fix_plus_comments.patch
Logged In: YES
user_id=1483238
Originator: NO
Thank you for quick reply and updating the comments.
Committed in r13026.