GeneralHighlightPass override WolfTheProblemSolverImpl registered problems
Answered
I want to highlight some files in the project view panel and write red line under the file which has issue to resolve.But when i use WolfTheProblemSolverImpl to register some problem i meet some strange thing.I write following code:
List<Problem> problems = new ArrayList<>();
vulnerabilities.forEach(new Consumer<Vulnerability>() {
@Override
public void accept(Vulnerability vulnerability) {
problems.add(VulnUtil.convertToWolfProblem(project, vulnerability));
}
});
wolfTheProblemSolver.weHaveGotNonIgnorableProblems(virtualFile, problems);
After i add these problems, the GeneralHighlightPass will execute after i registered.If the GeneralHighlightPass doesn't find any issue, it will clear this file's all problems. It cause the previous registered problem disappear.Here is the code(may be a bug?):
if (problems.isEmpty()) {
clearProblems(file);
return;
}

I don't know whether i should use WolfTheProblemSolverImpl in this way.
Please sign in to leave a comment.
Hi,
Please clarify your use case.
If you just want to highlight files with errors in the project view, all you have to implement is the
com.intellij.problemFileHighlightFilterextension. The implementation isCondition<VirtualFile>, and it should return true in case the file should be marked as an error in the project view if it contains any errors.There is no need to use WolfTheProblemSolver.
I found a similar situation in this link: Highlight a file with errors during inspection – IDEs Support (IntelliJ Platform) | JetBrains
But register problemFileHighlightFilter doesn't highlight the file contains errors.
Let me describe my situation, I have some information about the files in this project which has errors. I want to highlight all of them after the project is opened in the project view. How can i do that, I use WolfProblemSolver but it doesn't maintain i registered problems
It's hard to understand what is the use case, implementation and the issue.
Please share plugin sources or at least a minimal reproducible example and describe in steps how to reproduce the issue (and what is expected and actual behaviors).
Here is a picture, i want to let the file has red under line just as the following picture:
