boolean (@NotNull PsiElement context, @NotNull Document copyDocument, int newOffset) { PsiStatement statementParent = PsiTreeUtil.getNonStrictParentOfType(context, PsiStatement.class); if (statementParent == null || newOffset != statementParent.getTextRange().getEndOffset()) return false; if (statementParent instanceof PsiDeclarationStatement) return true; if (statementParent instanceof PsiExpressionStatement) { PsiExpression expression = ((PsiExpressionStatement)statementParent).getExpression(); return null != expression.getType(); } return false; }