TextRange () { if (usage instanceof PsiClass) { PsiIdentifier identifier = ((PsiClass)usage).getNameIdentifier(); if (identifier != null) return TextRange.from(identifier.getStartOffsetInParent(), identifier.getTextLength()); } else if (usage instanceof PsiMethod) { PsiIdentifier identifier = ((PsiMethod)usage).getNameIdentifier(); if (identifier != null) return TextRange.from(identifier.getStartOffsetInParent(), identifier.getTextLength()); } return super.getRangeInElement(); }