Reference on XML element - does not work with intellij idea 2016

I have problem in my Intellij Idea 2016 plugin which worked in v15.

For few of my project specific XML files I have written simple plugin which provides references between my files.

I have implemented PsiReferenceContributor where I have registered provider for XmlAttributeImpl.

psiReferenceRegistrar.registerReferenceProvider(PlatformPatterns.psiElement(XmlAttributeImpl.class),
new PsiReferenceProvider() {
@NotNull
@Override
public PsiReference[] getReferencesByElement(PsiElement element, ProcessingContext processingContext) {
XmlAttributeImpl literalExpression = (XmlAttributeImpl) element;
if ( some conditions ) {
return new PsiReference[]{new MyOwnReference(element)};

and my own implementation of PsiPolyVariantReference here called MyOwnReference search for parent elements in some other files.

This worked well and the value of element has automatically worked as a reference.

Since I have installed new version 2016, this is not working well. It seems that without specified TextRange id does not work at all. I have to set the Range only in limits of elements name.

e.g.

v15 myAttribute="123456" // bold part holds reference

v16 myAttribute="123456" // works when I set the TextRange(0, 10)

also other renges between (0,10) works well

myAttribute="123456" // with TextRange(2, 8)

But when I try to set range to the value e.g. (13, 18) it does not work.

Could, please,  someone help me how to solve this in version 16? For me this navigation is is quite common usecase and it save me a lot of time.

1 comment

Hello, have you solved this problem?

0

Please sign in to leave a comment.