GroovyPsiElement (GroovyFileBase file, int offset) { offset = CharArrayUtil.shiftForward(file.getText(), offset, " \t"); PsiElement element = file.findElementAt(offset); final GrDocComment docComment = PsiTreeUtil.getParentOfType(element, GrDocComment.class); if (docComment != null) { final GrDocCommentOwner owner = docComment.getOwner(); if (owner != null) { element = owner; } } if (element instanceof PsiComment) { element = PsiTreeUtil.nextVisibleLeaf(element); } return (GroovyPsiElement)PsiTreeUtil.findFirstParent(element, element11 -> isMovable(element11)); }