int (@NotNull Editor editor, boolean forward, @NotNull PsiFile file) { Document document = editor.getDocument(); int offset = editor.getCaretModel().getOffset(); EditorHighlighter editorHighlighter = BraceHighlightingHandler.getLazyParsableHighlighterIfAny(file.getProject(), editor, file); HighlighterIterator iterator = editorHighlighter.createIterator(offset); boolean matched = matchBrace(document.getCharsSequence(), file.getFileType(), iterator, forward); if (!matched) throw new AssertionError(); return iterator.getStart(); }