XmlAttributeDescriptor[] (XmlTag tag) { if (tag == null || !HtmlUtil.isHtml5Context(tag)) { return XmlAttributeDescriptor.EMPTY; } final List<String> currentAttrs = new ArrayList<>(); for (XmlAttribute attribute : tag.getAttributes()) { currentAttrs.add(attribute.getName()); } final Project project = tag.getProject(); final Collection<String> keys = CachedValuesManager.getManager(project).getCachedValue(project, () -> { final Collection<String> keys1 = FileBasedIndex.getInstance().getAllKeys(Html5CustomAttributesIndex.INDEX_ID, project); final GlobalSearchScope scope = GlobalSearchScope.allScope(project); return CachedValueProvider.Result.<Collection<String>>create(ContainerUtil.filter(keys1, key -> !FileBasedIndex.getInstance().processValues( Html5CustomAttributesIndex.INDEX_ID, key, null, (file, value) -> false, scope)), PsiModificationTracker.MODIFICATION_COUNT); }); if (keys.isEmpty()) return XmlAttributeDescriptor.EMPTY; boolean inCompletion = tag.getContainingFile().getVirtualFile() == null; final List<XmlAttributeDescriptor> result = new ArrayList<>(); for (String key : keys) { boolean add = true; if (inCompletion) { for (String attr : currentAttrs) { if (attr.equals(key + CompletionUtilCore.DUMMY_IDENTIFIER_TRIMMED)) { add = false; break; } } } if (add) result.add(new AnyXmlAttributeDescriptor(key)); } return result.toArray(XmlAttributeDescriptor.EMPTY); }