private static void completeTagTail(Template template, XmlElementDescriptor descriptor, PsiFile file, XmlTag context, boolean firstLevel) {
    boolean completeIt = (!firstLevel || !canHaveAttributes(descriptor, context))
                         && (file == null || XmlExtension.getExtension(file).shouldCompleteTag(context));
    switch (descriptor.getContentType()) {
      case XmlElementDescriptor.CONTENT_TYPE_UNKNOWN -> {}
      case XmlElementDescriptor.CONTENT_TYPE_EMPTY -> {
        if (completeIt) {
          template.addTextSegment(closeTag(context));
        }
      }
      case XmlElementDescriptor.CONTENT_TYPE_MIXED -> {
        if (completeIt) {
          template.addTextSegment(">");
          if (firstLevel) {
            template.addEndVariable();
          }
          else {
            template.addVariable(new MacroCallNode(new CompleteMacro()), true);
          }
          addTagEnd(template, descriptor, context);
        }
      }
      default -> {
        if (!addRequiredSubTags(template, descriptor, file, context)) {
          if (completeIt) {
            template.addTextSegment(">");
            template.addEndVariable();
            addTagEnd(template, descriptor, context);
          }
        }
      }
    }
  }
private static void completeTagTail(Template template, XmlElementDescriptor descriptor, PsiFile file, XmlTag context, boolean firstLevel)