Bug 537755 - IMarkerResolutionRelevance should also be applied to display quickfix tooltip
Summary: IMarkerResolutionRelevance should also be applied to display quickfix tooltip
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.8   Edit
Hardware: PC Linux
: P3 enhancement with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: Platform-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: needinfo
Depends on:
Blocks:
 
Reported: 2018-08-07 07:44 EDT by Julien HENRY CLA
Modified: 2018-11-14 09:40 EST (History)
5 users (show)

See Also:


Attachments
Screenshot (20.35 KB, image/png)
2018-08-07 07:44 EDT, Julien HENRY CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Julien HENRY CLA 2018-08-07 07:44:19 EDT
Created attachment 275302 [details]
Screenshot

Our plugin is contributing some MarkerResolutions. 

They are displayed when you hit Ctrl+1 in an editor on a marker.

Some users are complaining of the order, they would prefer to see "normal" Eclipse refactorings first. I just discovered the new IMarkerResolutionRelevance which seemed to be exactly what I was looking for. But after a quick test, it seems the order is only used when building the quick fix dialog, but not to display quick fixes in the editor tooltip (see screenshot).

Would it be possible to also apply IMarkerResolutionRelevance there?

Thanks
Comment 1 Dani Megert CLA 2018-08-15 03:50:23 EDT
Which editor?

Please attach a sample plug-in that demonstrates the issue.
Comment 2 Julien HENRY CLA 2018-08-27 03:36:49 EDT
(In reply to Dani Megert from comment #1)
> Which editor?

I reproduced with the Java Editor.


> Please attach a sample plug-in that demonstrates the issue.

Hum, this is quite some work. Do you really need that? Our plugin is open source:
https://github.com/SonarSource/sonarlint-eclipse so you can use it as a reproducer. 
* install it from the marketplace
* create a new Java project
* type some code that will trigger both a SonarLint marker and a JDT refactoring suggestion (see my screenshot)
* hit Ctrl + 1

Also I looked at the code, and the only place where IMarkerResolutionRelevance is used is when building the QuickFixPage:
https://github.com/eclipse/eclipse.platform.ui/blob/5cc6deb2c59b6282f7ee2bb8ccea4918838f27d9/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/views/markers/QuickFixPage.java#L264

So to me it is clear that this concept of resolution priority is not used when showing the resolutions in the Quick Fix tooltip.
Comment 3 Lars Vogel CLA 2018-08-27 03:48:39 EDT
Julien, could you upload a Gerrit? I'm happy to review it and test it, using your SonarLint plug-in. In case you are not familiar with Gerrit please feel free to reach out to me (Lars.Vogel@vogella.com), the base setup should be described here: http://www.vogella.com/tutorials/EclipsePlatformDevelopment/article.html#exericse-eclipse-user-creation-and-gerrit-server-configuration

Just for reference, we do hackathons on a regular basis and it typically takes  10-20 mins for the Gerrit setup.
Comment 4 Julien HENRY CLA 2018-08-27 05:51:19 EDT
Hi Lars,

Can you point me to the place that should be updated? I tried to look for the quick fix tooltip, but I can't find it. Is it something specific to JDT?
Comment 5 Lars Vogel CLA 2018-09-05 15:30:35 EDT
(In reply to Julien HENRY from comment #4)
> Hi Lars,
> 
> Can you point me to the place that should be updated? I tried to look for
> the quick fix tooltip, but I can't find it. Is it something specific to JDT?

Sorry Julien for the deplayed response. I think the relevant class is: JavaCorrectionProcessor.computeQuickAssistProposals(IQuickAssistInvocationContext) line: 249 a few lines later is seem to delegate to CompletionProposalComparator#getRelevance for the sorting.

Can you have a look if that is the place in which also your quickfixes show up? I debugged in a plain SDK.
Comment 6 Lars Vogel CLA 2018-11-14 08:41:56 EST
(In reply to Julien HENRY from comment #0)
> Created attachment 275302 [details]
> Screenshot
> 
> Our plugin is contributing some MarkerResolutions. 

Noopur, can you please tell us which class shows the quick fixes / quick assists? Looks like the sorting is not correct in this class.
Comment 7 Noopur Gupta CLA 2018-11-14 09:40:50 EST
(In reply to Lars Vogel from comment #6)
> Noopur, can you please tell us which class shows the quick fixes / quick
> assists? 

Showing the quick fixes/assists is done in org.eclipse.jface.text.quickassist.QuickAssistAssistant.showPossibleQuickAssists().

For relevance of Java proposals, see org.eclipse.jdt.ui.text.java.IJavaCompletionProposal.getRelevance().

See bug 517052 where IMarkerResolutionRelevance was added for QuickFixPage. Adding Vikas in cc in case you have any other questions related to this.