LocalInspectionTool showing messages as warning irrespective of ProblemHighlightType in ProblemDescriptor Follow
Answered
I want to show warnings and errors when a user runs inspect code but it is always showing all the messages as warning irrespective of what ProblemHighlightType is given.
public class SpecInspectionProvider extends LocalInspectionTool {
@Nullable
@Override
public ProblemDescriptor[] checkFile(@NotNull PsiFile file, @NotNull InspectionManager manager, boolean isOnTheFly) {
new ProblemDescriptor[]{manager.createProblemDescriptor(e, "message", null, ProblemHighlightType.ERROR, false, false)};
}
}
Is there a way to change warnings to errors i.e Specification 8 errors?
Please sign in to leave a comment.
Hi,
inspect code shows configured by user severity. Looks like you have set WARNING by default and didn't change that in the File | Settings | Editor | Inspections.
Anna
Thanks for the reply Anna.
The inspection can give both errors and warnings. So I don't want to change it in settings. Can It be changed by providing different ProblemHighlightType to ProblemDescriptor.
It would contradict user's settings, so it's not possible. The problem is more general: if you want your inspection to report different level of errors, you need to create 2 different inspections, no other solution is currently supported.