@Override
  public void invoke(final @NotNull Project project, final Editor editor, final PsiFile file) throws IncorrectOperationException {
    if (editor != null) {
      final int offset = editor.getCaretModel().getOffset();
      final PsiElement psiElement = file.findElementAt(offset);
      if (psiElement != null) {
        final PsiElement containingTag = psiElement.getParent().getParent();
        if (containingTag instanceof XmlTag tag) {
          TextRange tagRange = tag.getTextRange();

          String name = tag.getName();
          String toInsert = "</" + name + "><" + name + getAttrsWithoutId(tag) + ">";
          editor.getDocument().insertString(offset, toInsert);
          editor.getCaretModel().moveToOffset(offset + toInsert.length());
          PsiDocumentManager.getInstance(project).commitDocument(editor.getDocument());

          CodeStyleManager.getInstance(project).reformatRange(file, tagRange.getStartOffset(), tagRange.getEndOffset() + toInsert.length());
        }
      }
    }
  }
@Override
  public void invoke(final @NotNull Project project, final Editor editor, final PsiFile file)