TextRange () { if (usage instanceof PsiNameIdentifierOwner) { PsiElement identifier = ((PsiNameIdentifierOwner)usage).getNameIdentifier(); if (identifier != null) { final int startOffsetInParent = identifier.getStartOffsetInParent(); if (startOffsetInParent >= 0) { // -1 for light elements generated e.g. by lombok return TextRange.from(startOffsetInParent, identifier.getTextLength()); } else { return new UnfairTextRange(-1, -1); } } } return super.getRangeInElement(); }