Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 473966 - [hover] Javascript hovers no longer specify the word range
Summary: [hover] Javascript hovers no longer specify the word range
Status: RESOLVED FIXED
Alias: None
Product: Orion
Classification: ECD
Component: JS Tools (show other bugs)
Version: 9.0   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: 10.0   Edit
Assignee: Curtis Windatt CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-07-30 16:37 EDT by Curtis Windatt CLA
Modified: 2015-09-03 14:03 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Curtis Windatt CLA 2015-07-30 16:37:29 EDT
When providing tooltip content through the hover service, you can include 'offsetStart' and 'offsetEnd' properties on the returned data object.  This allows the contributor to specify the word range that the hover is anchored to.  When it is not set, the tooltip service will guess what 'word' will be selected.

We previously provided the information, but either with the introduction of Tern or the updated version of Tern, we have regressed.

You can see the effect by having:
/*
 * a
 */
function a(){
}

Hovering on the right side of the 'a' will put the tooltip in the right place.  Hovering on the left side of it will put the hover under 'function'.
Comment 1 Curtis Windatt CLA 2015-07-30 16:48:46 EDT
http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=3b9ef134a69fd378447b67759acb35feb9300953
I put in some smarter logic in tooltip.js to select the current word rather than the previous word when hovering at the start.  That will make the missing offsets less apparent in JS.

However, we should still be providing a consistent offset range to anchor the hover, otherwise you get three different hover placements depending on whether 'function' 'a' or '()' is selected.  Prior to Tern we always anchored the tooltip to the function name I believe.
Comment 2 Curtis Windatt CLA 2015-07-30 17:04:15 EDT
This is a regression of Bug 462028.
Comment 3 Michael Rennie CLA 2015-09-03 14:03:43 EDT
(In reply to Curtis Windatt from comment #2)
> This is a regression of Bug 462028.

This has been fixed in the tooltip.js code to not rely on a service consumer to tell the tooltip where to show. Closing as 'fixed'