private static @NotNull TemplateImpl expandTemplate(@NotNull TemplateImpl template,
                                                      Map<String, String> predefinedVarValues,
                                                      String surroundedText,
                                                      int segmentsLimit) {
    LiveTemplateBuilder builder = new LiveTemplateBuilder(EmmetOptions.getInstance().isAddEditPointAtTheEndOfTemplate(), segmentsLimit);
    if (predefinedVarValues == null && surroundedText == null) {
      return template;
    }
    int offset = builder.insertTemplate(0, template, predefinedVarValues);
    if (surroundedText != null) {
      builder.insertText(offset, surroundedText, true);
      builder.setIsToReformat(true);
    }
    return builder.buildTemplate();
  }
private static @NotNull TemplateImpl expandTemplate(@NotNull TemplateImpl template,
                                                      Map<String, String> predefinedVarValues,
                                                      String surroundedText,
                                                      int segmentsLimit)