List<LookupElement> (XmlTag tag, boolean includePrefix, ASTNode nameElement) { List<LookupElement> result = new ArrayList<>(); while (tag != null) { LookupElementBuilder builder = LookupElementBuilder.create(includePrefix || !nameElement.getText().contains(":") ? tag.getName() : tag.getLocalName()); result.add(LookupElementDecorator.withInsertHandler( TailTypeDecorator.withTail(AutoCompletionPolicy.GIVE_CHANCE_TO_OVERWRITE.applyPolicy(builder), TailType.createSimpleTailType('>')), XmlClosingTagInsertHandler.INSTANCE)); if (includePrefix) break; tag = tag.getParentTag(); if (tag != null && (XmlChildRole.CLOSING_TAG_NAME_FINDER.findChild(tag.getNode()) != null || XmlChildRole.START_TAG_START_FINDER.findChild(tag.getNode()) == null)) { break; } } return result; }