TextMateBracePair (int leftBraceStartOffset, @NotNull CharSequence fileText, @Nullable TextMateScope currentScope) { if (!TextMateService.getInstance().getPreferenceRegistry().isPossibleLeftHighlightingBrace(fileText.charAt(leftBraceStartOffset))) { return null; } Set<TextMateBracePair> pairs = getAllPairsForMatcher(currentScope); for (TextMateBracePair pair : pairs) { int endOffset = leftBraceStartOffset + pair.getLeft().length(); if (endOffset < fileText.length() && StringUtil.equals(pair.getLeft(), fileText.subSequence(leftBraceStartOffset, endOffset))) { return pair; } } return null; }