I’m developing a JetBrains plugin that performs various code analyses and displays the results in a separate tool window. I would like to enhance this by integrating the analysis results into the Problems tool window as custom problems under the File section.
To achieve this, I explored the Problems view code and found two relevant approaches:
Here, problem is an instance of FileProblem. I verified that this method was called with the correct problem, but nothing appeared in the Problems tool window.
This successfully displayed the problem in the Problems tool window, but it was categorized under Project Errors instead of appearing under the File section.
I would appreciate any insights on how to properly register and display custom problems in the File section of the Problems tool window.
The ProblemsView has two main panels (tabs) - the “File” tab (managed by HighlightingPanel) and the “Project Errors” tab (managed by ProblemsViewProjectErrorsPanelProvider).
The “File” tab is specifically designed to show problems related to the currently selected file, and it gets its data from the editor’s highlighting system, not from the ProblemsListener.
When you use ProblemsCollector.getInstance(project).problemAppeared(problem), your problem is being properly registered in the ProjectErrorsCollector (which implements ProblemsCollector), but this collector feeds into the “Project Errors” tab only.
The “File” tab doesn’t listen to ProblemsListener.TOPIC directly; instead, it gets its data from the editor’s markup model and error stripe.
To get your custom problems to appear in the “File” section, you need to create a custom annotation approach ( Annotator or ExternalAnnotator). Is it working for you?
Thank you so much for the detailed explanation.
Regarding the custom annotation approach you mentioned (Annotator or ExternalAnnotator), is it possible to use it solely to register and display custom findings in the “File” tab of the Problems tool window without showing any visual highlighting or gutter marks in the editor? Essentially, I’d like the issues to appear in the “File” section, but not affect the editor’s appearance.