Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 425924

Summary: Line hover has multiple same problems reported
Product: [ECD] Orion Reporter: Michael Rennie <Michael_Rennie>
Component: EditorAssignee: Mark Macdonald <mamacdon>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: gheorghe, mamacdon, Silenio_Quarti
Version: 5.0Flags: Silenio_Quarti: review+
Target Milestone: 5.0 RC1   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description Michael Rennie CLA 2014-01-16 13:12:34 EST
Consider the following snippet:

/**jslint node: true */

require("mongo").

In the gutter there are two problems reported:

1."Require is not defined"
2."Missing semicolon"

which is expected, but if you hover over the whitespace of the line - past the '.' - the popup shows a whole bunch of errors like:

"Parse Error: unexpected end of input"
Comment 1 Mark Macdonald CLA 2014-01-16 13:39:11 EST
Sounds related to bug 422867. The problem is that the editor's annotation hovers behave badly (appear at inappropriate times, repeat the same error many times) when you create an annotation whose range exceeds the EOL or EOF.

The workaround was to range-check the problem offsets before sending them to the editor. In this case, we are probably allowing an out-of-range annotation to slip past.
Comment 2 Mark Macdonald CLA 2014-01-28 17:58:50 EST
Ok, the problematic annotations here have this shape (where charCount is the number of characters in the file)
> {  start: charCount,
>    end: charCount
> }

When the editor attempts to get all annotations in the file, it does this:
> annotationModel.getAnnotations(0, charCount);

This does not return the problematic annotation, since `charCount` lies outside the range [0, charCount). So the editor never removes the annotation, and multiple such annotations tend to accumulate. They are shown when you hover over empty portions of the editor canvas.

Mike just released a fix that I think prevents the JS validator from producing these problematic annotations. But I would like to fix the general case too.

The fix is to allow getAnnotations() to be called without ranges, which returns everything
http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=70e5d68
Comment 3 Mark Macdonald CLA 2014-01-28 18:13:21 EST
(In reply to Mark Macdonald from comment #2)
Sorry, ignore the link in my previous comment. Here is the correct one
http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=43895e0
Comment 4 Bogdan Gheorghe CLA 2014-01-29 09:50:38 EST
The changes are fine. There might be a few other places we can use getAnnotations() instead of getAnnotations(0, charCount) (i.e actions.js).
Comment 5 Silenio Quarti CLA 2014-01-29 09:51:33 EST
The comment above is mine.
Comment 6 Mark Macdonald CLA 2014-01-29 11:42:44 EST
Thanks Silenio. pushed the commit:
http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=22d0851

Also changed a bunch of callers to use getAnnotations():
http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=2d5dd31