PsiElement () { final PsiElement rncElement = myFile.findElementAt(myStartOffset + myColumn); final ASTNode pattern = rncElement != null ? TreeUtil.findParent(rncElement.getNode(), RncElementTypes.PATTERN) : null; final ASTNode nameClass = pattern != null ? pattern.findChildByType(RncElementTypes.NAME_CLASS) : null; //noinspection ConstantConditions return nameClass != null ? nameClass.getPsi() : rncElement; }