I'm having an issue creating a reference from an Angular2 HTML template into my DSL. I have a PsiReferenceRegistrar that can succesfully create a reference and resolve it when the language is plain HTML. For this I have placed a reference on the XmlAttributeValue with the specific TextRange and all works fine.
However, most people in the project will use the Angular2 HTML template dialect which creates a whole new set of PSI elements in the tree. The XmlAttributeValue is still provided as a pluggable element and I can see the reference being created. However, when I try to goto the declaration it never resolves to the target element in my DSL. I have tried to alternate the TextRange from the full XmlAttributeValue to the lowest PsiElement in the tree (JSLiteralExpression), in every case I can see the reference being created and, is initially resolved by the annotator. When I deliberatly make the reference unresolvable I can see a 'Cannot resolve symbol' warning.
The html code:
<element onClick="mycomponent['somekey'].doSomething()" />
I want to create a reference on 'somekey', preferably without the quotations. I have tried it with TextRange that matches somekey, 'somekey' and the entire XML_ATTRIBUTE_VALUE. All return a resolvable reference, but that specified reference is not resolved when I ctrl+click the element.
I can see the nodetypes: HTMLTAG, XML_ATTRIBUTE and XML_ATTRIBUTE_VALUE being pluggable (I mean they are provided to the pattern matcher in the PsiReferenceRegistrar).
Is there something in the PsiTree that is overshadowing the reference that I'm creating? And can I make a Psi element in another language pluggable so it's added to the list of types that is considered by the PsiReferenceRegistrar.
This issue is kind of blocking for my next release since I wouldn't want to tell people they have to use the plain HTML parser to make the plugin integration work
Any help is much appreciated.