public static void highlightNext(@NotNull final PyCallableType callableType,
                                   @NotNull final List<PyCallableParameter> parameterList,
                                   @NotNull final Map<Integer, PyCallableParameter> indexToNamedParameter,
                                   @NotNull final Map<PyCallableParameter, Integer> parameterToHintIndex,
                                   @NotNull final Map<Integer, EnumSet<ParameterFlag>> hintFlags,
                                   boolean isArgsEmpty, int lastParamIndex) {
    boolean canOfferNext = true; // can we highlight next unfilled parameter
    for (EnumSet<ParameterFlag> set : hintFlags.values()) {
      if (set.contains(ParameterFlag.HIGHLIGHT)) {
        canOfferNext = false;
        break;
      }
    }
    // highlight the next parameter to be filled
    if (canOfferNext) {
      int highlightIndex = Integer.MAX_VALUE; // initially beyond reason = no highlight
      if (isArgsEmpty) {
        highlightIndex = callableType.getImplicitOffset(); // no args, highlight first (PY-3690)
      }
      else if (lastParamIndex < parameterList.size() - 1) { // lastParamIndex not at end, or no args
        if (!indexToNamedParameter.containsKey(lastParamIndex) || indexToNamedParameter.get(lastParamIndex).isPositionalContainer()) {
          highlightIndex = lastParamIndex; // stick to *arg
        }
        else {
          highlightIndex = lastParamIndex + 1; // highlight next
        }
      }
      else if (lastParamIndex == parameterList.size() - 1) { // we're right after the end of param list
        final PyCallableParameter parameter = indexToNamedParameter.get(lastParamIndex);
        if (parameter.isPositionalContainer() || parameter.isKeywordContainer()) {
          highlightIndex = lastParamIndex; // stick to *arg
        }
      }
      if (indexToNamedParameter.containsKey(highlightIndex)) {
        hintFlags.get(parameterToHintIndex.get(indexToNamedParameter.get(highlightIndex))).add(ParameterFlag.HIGHLIGHT);
      }
    }
  }
public static void highlightNext(@NotNull final PyCallableType callableType,
                                   @NotNull final List<PyCallableParameter> parameterList,
                                   @NotNull final Map<Integer, PyCallableParameter> indexToNamedParameter,
                                   @NotNull final Map<PyCallableParameter, Integer> parameterToHintIndex,
                                   @NotNull final Map<Integer, EnumSet<ParameterFlag>> hintFlags,
                                   boolean isArgsEmpty, int lastParamIndex)