XmlElementDescriptor[] (final XmlTag context) { final DomElement domElement = myManager.getDomElement(context); if (domElement == null) return EMPTY_ARRAY; List<XmlElementDescriptor> xmlElementDescriptors = new ArrayList<>(); for (DomCollectionChildDescription childrenDescription : domElement.getGenericInfo().getCollectionChildrenDescriptions()) { xmlElementDescriptors.add(new DomElementXmlDescriptor(childrenDescription, myManager)); } for (DomFixedChildDescription childrenDescription : domElement.getGenericInfo().getFixedChildrenDescriptions()) { xmlElementDescriptors.add(new DomElementXmlDescriptor(childrenDescription, myManager)); } final List<? extends CustomDomChildrenDescription> customs = domElement.getGenericInfo().getCustomNameChildrenDescription(); for (final CustomDomChildrenDescription custom : customs) { final CustomDomChildrenDescription.TagNameDescriptor tagNameDescriptor = custom.getTagNameDescriptor(); if (tagNameDescriptor == null) continue; final XmlTag xmlTag = domElement.getXmlTag(); for (final EvaluatedXmlName name : tagNameDescriptor.getCompletionVariants(domElement)) { AbstractDomChildrenDescriptor descriptor = new AbstractDomChildrenDescriptor(myManager) { @Override public String getDefaultName() { final String ns = xmlTag != null ? name.getNamespace(xmlTag, (XmlFile)xmlTag.getContainingFile()) : null; if (ns != null) { final String prefix = xmlTag.getPrefixByNamespace(ns); if (prefix != null) { return prefix + ":" + name.getXmlName().getLocalName(); } } return name.getXmlName().getLocalName(); } @Override public @Nullable PsiElement getDeclaration() { final PomTarget target = tagNameDescriptor.findDeclaration(domElement, name); return target == null ? null : PomService.convertToPsi(context.getProject(), target); } }; xmlElementDescriptors.add(descriptor); } xmlElementDescriptors.add(new AnyXmlElementDescriptor(this, getNSDescriptor())); } return xmlElementDescriptors.toArray(XmlElementDescriptor.EMPTY_ARRAY); }