TextRange (PsiMember member) { PsiModifierList modifierList = member.getModifierList(); if (modifierList == null) { return TextRange.from(member.getTextRange().getStartOffset(), 0); } PsiElement anchor = getAnchorKeyword(modifierList); if (anchor != null) { return anchor.getTextRange(); } anchor = PsiTreeUtil.getChildOfType(modifierList, PsiKeyword.class); if (anchor != null) { return TextRange.from(anchor.getTextRange().getStartOffset(), 0); } return TextRange.from(modifierList.getTextRange().getEndOffset(), 0); }