protected int getRBraceOffset(@NotNull final PsiFile file, @NotNull final Editor editor, int caretOffset) {
    CharSequence text = editor.getDocument().getCharsSequence();
    int offset = CharArrayUtil.shiftForward(text, caretOffset, " \t");
    final int fileLength = text.length();
    if (offset < fileLength && ")];,%<?".indexOf(text.charAt(offset)) < 0) {
      offset = calculateOffsetToInsertClosingBrace(file, text, offset).second;
      //offset = CharArrayUtil.shiftForwardUntil(text, caretOffset, "\n");
    }
    return Math.min(offset, fileLength);
  }
protected int getRBraceOffset(@NotNull final PsiFile file, @NotNull final Editor editor, int caretOffset)