Duplicate entries in completion popup

hi all
i am developing a plugin that manipulate xml file and i was tackling autoCompletion
after giving up trying to get tags and attribute names completion implemented by PsiReference.getVarient, i decided to give completionData a try,so i implemented it and override completeReference as the following

public void completeReference(PsiReference psiReference, Set set, CompletionContext completionContext, PsiElement psiElement) {
super.completeReference(psiReference, set, completionContext, psiElement);
if(psiReference.getElement() instanceof XmlTag){
set.add(new LookupItem(new Key("FirstTag"), "FirstTag"));

this works great and add FirstTag to the completion popup
THE PROBLEM IS
on the second time when the popup appears it shows TWO entries for FirstTag
i donot know how,as this is not possible due to the Set contract(no duplicate entries)
may be this set is not the final one that is passed to the gui and it is combined by the intelligent xml editing logic to obtain the final list and may be this explain the situation(one entry from me and one generated by the xml editor)
NOW whatever this was true or false
what is the solution to this double entry problem?
thanx in advance
joe

2 comments

hi all
any suggestion?
or anyway,is this a correct way to add entries?
what is completionVarient,ContextGetter... are there relevant here?
thanx all
joe

0

is this afeature,a bug?!!!
may i file a Jira for it?
OR , any response?!!!

joe

0

Please sign in to leave a comment.