void (AnnotationHolder holder, TextContent text) { List<TextChecker> checkers = TextChecker.allCheckers(); CheckerRunner runner = new CheckerRunner(text); runner.run(checkers, problem -> { if (problem.fitsGroup(RuleGroup.UNDECORATED_SINGLE_SENTENCE) && Text.isSingleSentence(Text.findParagraphRange(text, problem.getHighlightRanges().get(0)).subSequence(text))) { return null; } List<ProblemDescriptor> descriptors = runner.toProblemDescriptors(problem, true); if (descriptors.isEmpty()) return null; String message = problem.getDescriptionTemplate(true); String tooltip = problem.getTooltipTemplate(); LocalQuickFix[] fixes = runner.toFixes(problem, descriptors.get(0)); for (TextRange range : problem.getHighlightRanges()) { AnnotationBuilder annotation = holder .newAnnotation(SpellCheckerSeveritiesProvider.TYPO, message) .tooltip(tooltip) .textAttributes(SpellCheckerSeveritiesProvider.TYPO_KEY) .range(text.textRangeToFile(range)); for (QuickFix<?> fix : fixes) { annotation = annotation.withFix((IntentionAction)fix); } annotation.create(); } return null; }); }