PsiReference in XML attribute value using ReferenceProviderRegistry doesn't allow ctrl+click?

I've set up a ReferenceProvider which injects references into values of XML file
to Java classes and to other tags. Now, when I type a classname incorrectly,
IDEA highlights the attribute value in red. However, when I hold Ctrl and hover
over it, I see no blue underline, and Ctrl+Click doesn't do anything.

Am I doing something wrong? Here's my PsiReference class. It's straightforward:

class ShortClassReference implements PsiReference {
// the XmlToken which represents the attribute value
private final PsiElement attrValue;

public ShortClassReference(PsiElement attrValue) {
this.attrValue = attrValue;
}

public PsiElement getElement() {
return attrValue;
}

public TextRange getRangeInElement() {
return TextRange.from(0, attrValue.getTextRange().getLength());
}

@Nullable public PsiElement resolve() {
// long method omitted...
}

public String getCanonicalText() {
PsiClass resolved = (PsiClass) resolve();
return resolved == null ? attrValue.getText() :
resolved.getQualifiedName();
}

public PsiElement handleElementRename(String newElementName)
throws IncorrectOperationException {
throw new IncorrectOperationException();
}

public PsiElement bindToElement(PsiElement element)
throws IncorrectOperationException {
throw new IncorrectOperationException();
}

public boolean isReferenceTo(PsiElement element) {
PsiElement resolved = resolve();
return resolved != null && resolved.equals(element);
}

public Object[] getVariants() {
return new Object[0];
}

public boolean isSoft() {
return false;
}
}

Please sign in to leave a comment.