void (CompletionParameters parameters, final CompletionResultSet result, PsiElement element) { if (!XmlCompletionContributor.isXmlNameCompletion(parameters)) { return; } result.stopHere(); if (!(element.getParent() instanceof XmlTag tag)) { return; } final XmlTag parentTag = tag.getParentTag(); if (parentTag == null) return; final XmlContentDFA dfa = XmlContentDFA.getContentDFA(parentTag); if (dfa == null) return; ApplicationManager.getApplication().runReadAction(() -> { for (XmlTag subTag : parentTag.getSubTags()) { if (subTag == tag) { break; } dfa.transition(subTag); } List<XmlElementDescriptor> elements = dfa.getPossibleElements(); for (XmlElementDescriptor elementDescriptor: elements) { addElementToResult(elementDescriptor, result); } }); }