@Override
  public final @Nullable TextRange surroundElements(@NotNull Project project, @NotNull Editor editor, PsiElement @NotNull [] elements) {
    if (elements.length == 0) {
      return null;
    }
    PsiDocumentManager manager = PsiDocumentManager.getInstance(project);
    Document document = editor.getDocument();
    PsiFile file = manager.getPsiFile(document);
    if (file == null) return null;
    WriteAction.run(() -> manager.doPostponedOperationsAndUnblockDocument(document));
    ActionContext context = ActionContext.from(editor, file);
    var commandSupplier = new Supplier<ModCommand>() {
      TextRange range;
      
      @Override
      public ModCommand get() {
        ModCommand command = ModCommandSurrounder.this.surroundElements(context, elements);
        ModNavigate navigate = ContainerUtil.findInstance(command.unpack(), ModNavigate.class);
        if (navigate != null) {
          range = TextRange.create(navigate.selectionStart(), navigate.selectionEnd());
        }
        return command;
      }
    };
    String title = getTemplateDescription();
    ModCommandExecutor.executeInteractively(context, title, editor, commandSupplier);
    return commandSupplier.range;
  }
@Override
  public final @Nullable TextRange surroundElements(@NotNull Project project, @NotNull Editor editor, PsiElement @NotNull [] elements)