@Override
  public int tryJoinStatements(@NotNull GrStatement first, @NotNull GrStatement second) {
    final PsiElement semi = PsiImplUtil.findTailingSemicolon(first);

    final Document document = PsiDocumentManager.getInstance(first.getProject()).getDocument(first.getContainingFile());
    if (document == null) return CANNOT_JOIN;
    final int endOffset = second.getTextRange().getStartOffset();
    if (semi != null) {
      final int offset = semi.getTextRange().getEndOffset();
      document.replaceString(offset, endOffset, " ");
      return offset + 1;
    }
    else {
      final int offset = first.getTextRange().getEndOffset();
      document.replaceString(offset, endOffset, "; ");
      return offset + 2;
    }
  }
@Override
  public int tryJoinStatements(@NotNull GrStatement first, @NotNull GrStatement second)