private static void updateParameterValues(final @NotNull Editor editor, @NotNull Caret caret, @NotNull PsiMethod targetMethod,
                                            @NotNull PsiElement exprList, int lbraceOffset, @NotNull Map<String, String> enteredParameters,
                                            boolean virtualComma) {
    PsiParameterList parameterList = targetMethod.getParameterList();
    final int parametersCount = parameterList.getParametersCount();
    caret.moveToOffset(lbraceOffset); // avoid caret impact on hints location
    final int endOffset = exprList.getTextRange().getEndOffset() - 1;
    int lastParameterWithValue = -1;
    if (virtualComma) {
      for (int i = parametersCount - 1; i >= 0; i--) {
        String key = getParameterKey(targetMethod, i);
        String value = enteredParameters.getOrDefault(key, "");
        if (!value.isEmpty()) {
          lastParameterWithValue = i;
          break;
        }
      }
    }
    int paramsToInsert = virtualComma ? lastParameterWithValue + 1 : parametersCount;
    Ref<Integer> targetCaretPosition = new Ref<>();
    WriteAction.run(() -> {
      int offset = lbraceOffset + 1;
      editor.getDocument().deleteString(offset, endOffset);
      for (int i = 0; i < paramsToInsert; i++) {
        String key = getParameterKey(targetMethod, i);
        String value = enteredParameters.getOrDefault(key, "");
        if (value.isEmpty() && targetCaretPosition.isNull()) targetCaretPosition.set(offset);
        if (i < parametersCount - 1 && (!virtualComma || i < paramsToInsert - 1 || targetCaretPosition.isNull())) value += ", ";
        editor.getDocument().insertString(offset, value);
        offset += value.length();
      }
      if (targetCaretPosition.isNull()) targetCaretPosition.set(offset);
    });
    caret.moveToOffset(targetCaretPosition.get());
  }
private static void updateParameterValues(final @NotNull Editor editor, @NotNull Caret caret, @NotNull PsiMethod targetMethod,
                                            @NotNull PsiElement exprList, int lbraceOffset, @NotNull Map<String, String> enteredParameters,
                                            boolean virtualComma)