TextRange (@NotNull PomTarget target, @NotNull PsiElement declaringElement) { if (target instanceof PsiDeclaredTarget declaredTarget) { TextRange nameIdentifierRange = declaredTarget.getNameIdentifierRange(); if (nameIdentifierRange != null) { PsiElement navigationElement = declaredTarget.getNavigationElement(); return relateRange(navigationElement, nameIdentifierRange, declaringElement); } } return rangeOf(declaringElement); }