PsiElement () { PsiElement startElement = getStartElement(); if (myEndSmartPointer == null) { return startElement; } PsiElement endElement = getEndElement(); if (startElement == endElement) { return startElement; } if (startElement == null || endElement == null) return null; return PsiTreeUtil.findCommonParent(startElement, endElement); }