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

Bug 456715

Summary: [Hover] Folding (closing) a comment section causes hovers over annotations to appear in the wrong spot
Product: [ECD] Orion Reporter: Eric Moffatt <emoffatt>
Component: ClientAssignee: Curtis Windatt <curtis.windatt.public>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: curtis.windatt.public, Silenio_Quarti
Version: unspecified   
Target Milestone: 10.0   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Bug Depends on:    
Bug Blocks: 450152    

Description Eric Moffatt CLA 2015-01-05 15:47:28 EST
If I close a comment section then my tooltip appears in the wrong position. The likely cause is in tooltip.js#_setContentRange which is using the textView's 'getLocationAtOffset' method not computing the affect of the folded comment or (alternatively) the annotation's offsets haven't been updated by the folding ?
Comment 1 Eric Moffatt CLA 2015-01-05 15:50:05 EST
To reproduce:

open tooltip.js and hover over one of the unused 'event' annotations (roughtly line 64). Note that the tooltip appears directly below the annotation.

Now go to the top of the file and close the copyright comment and then go back a re-hover over the initial annotation...now the annotation appears well below (and offset in X) where it should be...
Comment 2 Curtis Windatt CLA 2015-03-25 15:21:45 EDT
*** Bug 463018 has been marked as a duplicate of this bug. ***
Comment 3 Curtis Windatt CLA 2015-04-01 16:27:12 EDT
http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=03b26d43b3346b34b6ab9a1648e65f0d44127263

Fixed in master

The offsets given for annotations and hovering are from the text model that is not adjusted for folded contents (that would be projection text model).

The fix is to map the offsets to the parent model.
Comment 4 Curtis Windatt CLA 2015-04-01 17:26:36 EDT
It still appears to be failing in some of my test files with multiple comment sections.  Reopening.
Comment 5 Curtis Windatt CLA 2015-04-01 17:33:28 EDT
In javascript, the contributed hovers can provide more accurate offsets for the token the user is hovering over (ex: selecting the entire function name including punctuation vs using the closest word).  The offsets calculated in the hover, using a passed in textView, already account for the collapsed comments.

Silenio mentioned that annotation offsets are always in the base model.

We just need to be consistent about which model we use where.
Comment 6 Curtis Windatt CLA 2015-08-06 15:30:21 EDT
Opened Bug 473966 because the JS hovers no longer provide hints on the anchor area.  There is a different code path when calculating the enclosing word that uses findNextOffset().  findNextOffset needs to have the offsets adjusted to the projection model or it throws exceptions, Bug 473956.

http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=ad3a8a17cbbb4d65f64a8b48bd44d73826e3f40e
This fix will adjust the offsets for the folded comments in both scenarios (plug-in provides offsets hints or using findNextOffset to get the enclosing word).