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

Bug 495705

Summary: Wrong link in tooltip to open dependency file
Product: [ECD] Orion Reporter: Silenio Quarti <Silenio_Quarti>
Component: ClientAssignee: Grant Gayed <grant_gayed>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: emoffatt, Michael_Rennie
Version: 12.0   
Target Milestone: 12.0   
Hardware: PC   
OS: Mac OS X   
Whiteboard:

Description Silenio Quarti CLA 2016-06-08 11:33:35 EDT
Clone this repo (https://github.com/GianlucaGuarini/es6-project-starter-kit.git).
Open "tasks/test/index.js";
Hover "require('../_utils')"

The link in the tooltip is

https://beta3.hub.jazz.net/code/edit/edit.html#/code/file/squarti-OrionContent/org.eclipse.orion.client/modules/orionode/README.md,editor=orion.editor.markdown,anchor=/code/file/squarti-OrionContent/es6-project-starter-kit/tasks/_utils.js

The wrong file is opened.

I also have the org.eclipse.orion.client in my workspace and I opened README.md before I followed the steps above. I am not sure the problem after a refresh.
Comment 1 Michael Rennie CLA 2016-06-08 13:21:53 EDT
Something fishy is happening here. 

From the tools we only pass this back to the hover framework (as part of an object, indicating it should be processed as markdown:

"[_utils.js](#/file/es6-project-starter-kit/tasks/_utils.js) - Orionode Workspace/es6-project-starter-kit/tasks/_utils.js"

it seems like once you open a split markdown editor, you always get the split editor path added during hovers??
Comment 2 Michael Rennie CLA 2016-06-09 14:16:06 EDT
On the JS side of things we use the following code to create our HREF:

if(file.name && file.path && file.contentType) {
  hover += '[';
  var href = new URITemplate("#{,resource,params*}").expand( //$NON-NLS-1$
    	{
    	  resource: file.location,
    	  params: {}
    	});
hover += file.name + ']('+href+') - '+file.path+'\n\n'; //$NON-NLS-3$ //$NON-NLS-2$ //$NON-NLS-1$
}

Where file.location is equal to '#/file/es6-project-starter-kit/tasks/_utils.js'
Comment 3 Michael Rennie CLA 2016-06-09 14:34:03 EDT
I debugged through this and it appears that the markdown editor is contributing a renderer (or something) to Marked so when the hover support uses Marked to format the link, the editor renderer augments the markdown.

Not sure what the 'right' thing to do here is. Perhaps when navigating away from the markdown editor, it should clean up after itself and remove any renderers / etc.
Comment 4 Michael Rennie CLA 2016-06-09 14:39:04 EDT
For context, debugging from hover.js#renderMarkdown will take you into markdownEditor#filterOutputLink after you have opened the editor at least once.