TextMateBracePair (int rightBraceEndOffset, @NotNull CharSequence fileText, @Nullable TextMateScope currentSelector) { if (!TextMateService.getInstance().getPreferenceRegistry().isPossibleRightHighlightingBrace(fileText.charAt(rightBraceEndOffset - 1))) { return null; } Set<TextMateBracePair> pairs = getAllPairsForMatcher(currentSelector); for (TextMateBracePair pair : pairs) { int startOffset = rightBraceEndOffset - pair.getRight().length(); if (startOffset >= 0 && StringUtil.equals(pair.getRight(), fileText.subSequence(startOffset, rightBraceEndOffset))) { return pair; } } return null; }