private static String handleParameter(@NotNull ParameterInfo info, ReplacementInfo replacementInfo, int offset, String template) {
    final MatchResult matchResult = replacementInfo.getNamedMatchResult(info.getName());
    assert matchResult != null;

    final StringBuilder result = new StringBuilder();
    if (matchResult.isMultipleMatch()) {
      PsiElement previous = null;
      for (MatchResult child : matchResult.getChildren()) {
        final PsiElement match = child.getMatch().getParent();
        if (previous != null) addSeparatorText(previous, match, result);
        appendParameter(info, child, offset + result.length(), result.append(template));
        previous = match;
      }
    }
    else {
      result.append(template);
      appendParameter(info, matchResult, offset, result);
    }
    return result.toString();
  }
private static String handleParameter(@NotNull ParameterInfo info, ReplacementInfo replacementInfo, int offset, String template)