int (@NotNull CharSequence text, int startOffset, int endOffset) { CharSequence input = text.subSequence(startOffset, endOffset); for (TodoPattern pattern : TodoConfiguration.getInstance().getTodoPatterns()) { Pattern p = pattern.getPattern(); if (p != null) { Matcher matcher = p.matcher(input); if (matcher.find()) { return startOffset + matcher.start(); } } } return -1; }