LightFieldBuilder incorrect completion

I add new fields (not static) to class elements by PsiAugmentProvider. With this part is all fine.
But when I write field name in editor, and press enter (in automcomplete or without), editor write class name before field call.

Example:
Plugin add field with name someField to class Ex: public String someField;
(in LightFieldBuilder I set Ex as containingClass )

class Ex {
     public void someMethod() {
          Ex.someField          // expected only "someField"
     }
}

5 comments
Comment actions Permalink

Hi,
I've tried IDEA 14.1 EAP with the following augmenter:

 
if (type == PsiField.class) {
  augments.add((Psi)new LightFieldBuilder("someField", PsiType.BOOLEAN, aClass).setContainingClass(aClass));
}


and I don't get "someField" completion after class qualifier (but get it after instance qualifier). Could you please provide a reproducible code sample? Alternatively, you can debug JavaCompletionProcessor#execute and check why this completion item isn't discarded immediately.

0
Comment actions Permalink

Sorry, but you have misunderstood me.
I typed someField (without any prefix, without class name), and then auto complete propose me "someField" as variant, I choose it, and then I have "Ex.someField".
Not after class qualifier or instance.

0
Comment actions Permalink

I see! To blame is areElementsEquivalent check at VariableLookupItem.java:223, because it compares light fields from the original and copied class, and they're not equivalent (because so it is written in PsiElementBase#isEquivalentTo). We'll try to fix it in IDEA 14.1 EAP, thanks!

0
Comment actions Permalink

Pushed to the master

0

Please sign in to leave a comment.