How to use "Group by Inspection" for problems that are created by an annotation?

已回答

In the Problems window, I want to be able to use "Group by Inspection" for problems that are generated by my custom ExternalAnnotator, such that all errors and warnings generated by my custom ExternalAnnotator can be collapsed and expanded as needed. I need to highlight my custom errors and warnings using ExternalAnnotator because it has tooltip functionality, which creating a ProblemDescriptor and registering it in a custom LocalInspectionTool does not have.

Simply creating a custom ProblemGroup and setting that during the creation of my AnnotationBuilder does not do this. I was only able to get the Group by Inspection functionality by creating a custom Code Inspection, but once again that does not offer the tool tip functionality that I need. How can I solve this?

0

Could you please clarify what exactly you mean by “tooltip" here? How do you construct ProblemDescriptor?

I need to highlight my custom errors and warnings using ExternalAnnotator because it has tooltip functionality, which creating a ProblemDescriptor and registering it in a custom LocalInspectionTool does not have.

0

I am creating ProblemDescriptors as such: val problemDescriptor = inspectionManager.createProblemDescriptor(file, range, message, problemType, false, MyQuickFix())

By tooltip, I just mean the tooltip that occurs on hover. I've since realized that I can use <html> tags in order to get the styling that I need for the tooltip generated by the ProblemDescriptor, so my original problem doesn't really make sense.

However, now my issue is that the tooltip text shows up in the Problems window problem description. Is there anyway I can have a different descriptionTemplate from tooltipTemplate in each error's ProblemDescriptor? For example, I have a message and then a popupMessage variable that I want to have as the problem description and the tooltip text, respectively.

0

could you please attach the screenshot of what you have and what do you want to achieve? UNfortunately I don't see any tooltips in my Problems window

0

Sorry, its not that I want to have a tooltip for the Problems window. I want to have the text of the Problem in the problems window be different from the text in the problem's hover tooltip. In this example, they are the same. 

For my implementation of my code inspection, I have a chunk of HTML text and a chunk of plaintext. The tooltip should include the HTML text and the problem window description should have the plaintext. I've noticed that in ProblemDescriptor there is a default getTooltipTemplate but it returns the result of getDescriptionTemplate and InspectionManager's createProblemDescriptor only allows defining descriptionTemplate. I would like to be able to set two different values for descriptionTemplate and tooltipTemplate.

I was able to achieve this behavior with ExternalAnnotator because it allows me to define the two seperately with the AnnotationBuilder but I can't do the same with my code inspection.

0

I've solved this issue by creating a ProblemDescriptor with ProblemDescriptorBase constructor and overriding just the getTooltipTemplate function.

0

请先登录再写评论。