GroovyPsiElement (SourcePosition position) { PsiFile file = position.getFile(); if (!(file instanceof GroovyFileBase)) return null; PsiElement element = file.findElementAt(position.getOffset()); if (element == null) return null; return getEnclosingPsiForElement(element); }