boolean (@NotNull final Editor editor, @NotNull final IElementType lt, @NotNull final IElementType gt, @NotNull final TokenSet invalidInsideReference) { //need custom handler, since brace matcher cannot be used if (!CodeInsightSettings.getInstance().AUTOINSERT_PAIR_BRACKET) return false; int offset = editor.getCaretModel().getOffset(); if (offset == editor.getDocument().getTextLength()) return false; if (computeBracesBalance(editor, offset, lt, gt, invalidInsideReference, false) != 0) { return false; } EditorModificationUtil.moveCaretRelatively(editor, 1); return true; }