I'm trying to extend the HTML editor: add custom attributes to the element attributes completion list (some HTML elements may have custom attributes). I have performed the actions below:
1. Registered the reference provider:
ReferenceProvidersRegistry registry = ReferenceProvidersRegistry.getInstance(_project);
registry.registerReferenceProvider(XmlElement.class, new MyAttributeProvider(_project));
2. Added the MyAttributeProvider class that implements PsiReferenceProvider and implemented the getReferencesByElement(PsiElement) method which returns one element array with MyReference (implements PsiReference).
If I press Ctrl-space in the HTML editor to show element attribute variants then MyAttributeProvider.getReferencesByElement(PsiElement) is called. Then MyReference.getRangeInElement() is called and standard html attributes menu called (so my code doesn't take effect).
What's wrong? Do I need to register custom language type? And please shed light which PsiReference methods are called on code completion.