Highlight a file with errors during inspection
Answered
Hi everyone,
I am writing a plugin that runs a set of code inspections when a project is first opened. This means all inspections are being run from InspectionEngine.runInspectionOnFile in a StartupActivity class. When these inspections complete, I need to highlight all files that contain errors (preferably underline them with red).
How would I do this?
Thanks!
Please sign in to leave a comment.
Where do want to highlight all files containing errors? PS: Please make sure to provide ability to cancel this automatic run of heavy activity on startup.
Sorry for the delayed response.
I would like the files in the project view (left panel) to have the red underlines.
You need to provide an instance of EP com.intellij.problemFileHighlightFilter where you implement Condition<VirtualFile> and return true for all files which should be error-highlighted.
Hi Yann,
Thanks for the response. I finally had some time to try this out, but unfortunately no files are being highlighted when my StartupActivity class finishes, and at no point is the value method printing anything. Here is what I have:
plugin.xml has this line:
PrivacyErrorHighligher.java:
It doesn't seem that this EP is running since I am not seeing print statements, and no files are being highlighted.
To be clear, I need to highlight files at the end of my StartupActivity, which gets a list of problem files. I don't know at what point this EP runs. I pretty much copied what I saw in the get gauge project.
Any ideas? Thanks!
I need to see the full plugin's sources to determine what could be wrong.
Please note that the Highlighting Condition Filter has no relationship whatsoever to your startup activity, it will just add additional files which do have highlighting results.