PsiElement (Editor editor, PsiFile psiFile) { PsiElement atCaret = super.getStatementAtCaret(editor, psiFile); if (atCaret instanceof PsiWhiteSpace) return null; while (atCaret != null && !PsiUtil.isExpressionStatement(atCaret)) { if (atCaret instanceof PsiMethod || atCaret instanceof GrDocComment || atCaret instanceof GrTypeDefinition) return atCaret; atCaret = atCaret.getParent(); } return atCaret; }