Show custom errors Project Errors tab
Answered
Hi,
I'd like to show errors (HighlightInfo set by TextEditorHighlightingPass) in the Problems/Project Errors tab. Errors may belong to several files in a project, so need to show them all as a tree. Noticed in your code (isInSourceContent in HighlightingErrorsProvider) that you check that files must be a part of sources to do so. Is there a way to avoid this check? Didn't find any appropriate extension point for that.
Thank you.
Please sign in to leave a comment.
Hi, please checkout com.intellij.analysis.problemsView.ProblemsProvider EP and its implementations.
There is no such EP, neither in https://plugins.jetbrains.com/docs/intellij/extension-point-list.html nor in the community code.
Hi, there is a service `com.intellij.analysis.problemsView.ProblemsCollector` and you can contribute your problems via it. To use `com.intellij.analysis.problemsView.Problem` you need to implement your own `com.intellij.analysis.problemsView.ProblemsProvider`.
As an example, you can check how `com.intellij.analysis.problemsView.toolWindow.ProjectErrorsCollector` is implemented.
Sorry, I didn't really get the part about `isInSourceContent`, it is not obligatory, you can add errors even for files not under source root. What kind of extension point do you need?
Thank you for clarification. I have a json file with a few HighlightInfo objects on it. They are shown only in Problems / Current File tab.
If I move the file into the src folder they also appear in the Problems / Project Erros tab.
I believe this is due to the following code: if (project.isDisposed || !ProjectFileIndex.getInstance(project).isInSourceContent(file)) return
I need an EP to avoid this restriction. So you are saying that implementing a custom ProblemsProvider, subscribing to ProblemListener.TOPIC and setting it as project service in the plugin.xml will do the job, right?
Does it mean you want to show errors for the project file that does not belong to any source/test/resource root? It looks strange for me.
I've added `!isInSourceContent` to filter out files excluded from a project. I think it is possible to use `isExcluded` instead. Could you please file an issue for me?
Also, you can add any problems to the Project Errors from your own service manually
Yes, we work with errors in swagger files that may be located in any project folder depending on the user choice.
Idea with isExcluded sounds good, I created a ticket here: https://intellij-support.jetbrains.com/hc/en-us/requests/3282631
Thank you for fast response.