Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 454809 - [Hover] Annoying hovers shown on occurrences annotations
Summary: [Hover] Annoying hovers shown on occurrences annotations
Status: RESOLVED FIXED
Alias: None
Product: Orion
Classification: ECD
Component: Client (show other bugs)
Version: 7.0   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: 8.0   Edit
Assignee: Curtis Windatt CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 453554
Blocks:
  Show dependency tree
 
Reported: 2014-12-10 15:58 EST by Mark Macdonald CLA
Modified: 2015-01-13 17:09 EST (History)
2 users (show)

See Also:


Attachments
screenshot (12.82 KB, image/png)
2014-12-10 15:58 EST, Mark Macdonald CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Macdonald CLA 2014-12-10 15:58:55 EST
Created attachment 249325 [details]
screenshot

1. Open a JS file
2. Enable Mark Occurrences
3. Put the cursor over an occurrence. 

You end up with an unhelpful hover showing the same code you're already looking at (see screenshot).
Comment 1 Curtis Windatt CLA 2014-12-10 16:09:20 EST
I think the intention with the projection hover was so if you hover on the rulers you can see the line of code it is talking about.  We don't yet track where the annotation comes from (left ruler, right ruler, text).

In Bug 453554 we want to use this info to not display quickfixes when hovering over the left ruler.
Comment 2 Curtis Windatt CLA 2015-01-08 17:33:55 EST
http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=dae14bdad766aef9a457ed733a9e7b1d2a144061
Fixed in master

Now that I have context of the tooltip source, it no longer displays the projection text if you are hovering in the editor.  It still displays if you hover over the ruler.
Comment 3 Eric Moffatt CLA 2015-01-12 13:24:20 EST
Curtis, I've reverted this change since it broke most of the rest of the hovers...

The root cause was an interaction between the new 'context' field you added and some existing code about line ~284 in tooltip.js

Mike has a suggested fix wher we change that code to look like this..

if (this.hover && info.offset !== undefined && !contents) {
   var context; 
   if (info.context){
      context = info.context;
      context.offset = info.offset;
   } else {
      context = {offset: info.offset};
}
this._hoverInfo = this.hover.computeHoverInfo(context);
			}
Rather than just commit that fix I'd prefer to go over the logic a bit first (i.e. was the clash with the existing 'context' accidental...).
Comment 4 Michael Rennie CLA 2015-01-12 13:27:31 EST
(In reply to Eric Moffatt from comment #3)

> Mike has a suggested fix wher we change that code to look like this..


This would be a better fix:

if (this.hover && info.offset !== undefined && !contents) { 
 var context = Object.create(null); 
 if (info.context){
  context = info.context;
 }
 context.offset = info.offset;
 this._hoverInfo = this.hover.computeHoverInfo(context);
}
Comment 5 Curtis Windatt CLA 2015-01-13 17:09:47 EST
(In reply to Michael Rennie from comment #4)
> This would be a better fix:
> 
> if (this.hover && info.offset !== undefined && !contents) { 
>  var context = Object.create(null); 
>  if (info.context){
>   context = info.context;
>  }
>  context.offset = info.offset;
>  this._hoverInfo = this.hover.computeHoverInfo(context);
> }

http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=4b933ea8703c45e3f0342529f3a9c4377b21506f

Used this logic, reapplied my fix and tested js hovers, js nav hovers, css hovers, annotations in the ruler, diff and blame.