public static @Nullable <E extends PsiElement> E findArgumentList(PsiFile file, int offset, int lbraceOffset,
                                                          @NotNull ParameterInfoHandlerWithTabActionSupport findArgumentListHelper,
                                                          boolean allowOuter){
    if (file == null) return null;

    CharSequence chars = file.getViewProvider().getContents();
    if (offset >= chars.length()) offset = chars.length() - 1;
    int offset1 = CharArrayUtil.shiftBackward(chars, offset, " \t\n\r");
    if (offset1 < 0) return null;
    boolean acceptRparenth = true;
    boolean acceptLparenth = false;
    if (offset1 != offset){
      offset = offset1;
      acceptRparenth = false;
      acceptLparenth = true;
    }

    PsiElement element = file.findElementAt(offset);
    if (element == null) return null;
    PsiElement parent = element.getParent();

    while(true){
      if (findArgumentListHelper.getArgumentListClass().isInstance(parent)) {
        TextRange range = parent.getTextRange();
        if (range != null) {
          if (!acceptRparenth){
            if (offset == range.getEndOffset() - 1){
              PsiElement[] children = parent.getChildren();
              if (children.length == 0) return null;
              PsiElement last = children[children.length - 1];
              if (last.getNode().getElementType() == findArgumentListHelper.getActualParametersRBraceType()){
                parent = parent.getParent();
                continue;
              }
            }
          }
          if (!acceptLparenth){
            if (offset == range.getStartOffset()){
              parent = parent.getParent();
              continue;
            }
          }
          if (lbraceOffset >= 0 && range.getStartOffset() != lbraceOffset){
            if (!allowOuter) return null;
            parent = parent.getParent();
            continue;
          }
          break;
        }
      }
      if (parent instanceof PsiFile || parent == null) return null;

      final Set<? extends Class> set = findArgumentListHelper.getArgListStopSearchClasses();
      for (Class aClass : set) {
        if (aClass.isInstance(parent)) return null;
      }

      parent = parent.getParent();
    }

    PsiElement listParent = parent.getParent();
    for(Class c: (Set<Class<?>>)findArgumentListHelper.getArgumentListAllowedParentClasses()) {
      if (c.isInstance(listParent)) return (E)parent;
    }

    return null;
  }
public static @Nullable <E extends PsiElement> E findArgumentList(PsiFile file, int offset, int lbraceOffset,
                                                          @NotNull ParameterInfoHandlerWithTabActionSupport findArgumentListHelper,
                                                          boolean allowOuter)