@Override protected void addCompletions(@NotNull CompletionParameters parameters, ProcessingContext context, @NotNull CompletionResultSet result) { PsiReference reference = parameters.getPosition().getContainingFile().findReferenceAt(parameters.getOffset()); if (reference instanceof XmlAttributeReference) { addAttributeReferenceCompletionVariants((XmlAttributeReference)reference, result, null); } }
public static void addAttributeReferenceCompletionVariants(XmlAttributeReference reference, CompletionResultSet result, @Nullable InsertHandler<LookupElement> replacementInsertHandler) { final XmlTag declarationTag = reference.getElement().getParent(); LOG.assertTrue(declarationTag.isValid()); final XmlElementDescriptor parentDescriptor = declarationTag.getDescriptor(); if (parentDescriptor != null) { final XmlAttribute[] attributes = declarationTag.getAttributes(); XmlAttributeDescriptor[] descriptors = parentDescriptor.getAttributesDescriptors(declarationTag); descriptors = HtmlUtil.appendHtmlSpecificAttributeCompletions(declarationTag, descriptors, reference.getElement()); addVariants(result, attributes, descriptors, reference.getElement(), replacementInsertHandler); } }
@Override public void addCompletions(@NotNull CompletionParameters parameters, ProcessingContext context, @NotNull CompletionResultSet result) { PsiReference reference = parameters.getPosition().getContainingFile().findReferenceAt(parameters.getOffset()); if(reference instanceof XmlAttributeReference) { addAttributeReferenceCompletionVariants((XmlAttributeReference) reference, result, null); } }
public static void addAttributeReferenceCompletionVariants(XmlAttributeReference reference, CompletionResultSet result, @Nullable InsertHandler<LookupElement> replacementInsertHandler) { final XmlTag declarationTag = reference.getElement().getParent(); LOG.assertTrue(declarationTag.isValid()); final XmlElementDescriptor parentDescriptor = declarationTag.getDescriptor(); if(parentDescriptor != null) { final XmlAttribute[] attributes = declarationTag.getAttributes(); XmlAttributeDescriptor[] descriptors = parentDescriptor.getAttributesDescriptors(declarationTag); descriptors = HtmlUtil.appendHtmlSpecificAttributeCompletions(declarationTag, descriptors, reference.getElement()); addVariants(result, attributes, descriptors, reference.getElement(), replacementInsertHandler); } }