Self (final int index, final ElementPattern<? extends PsiMethod> methodPattern) { final PsiNamePatternCondition nameCondition = ContainerUtil.findInstance(methodPattern.getCondition().getConditions(), PsiNamePatternCondition.class); return with(new PatternCondition<T>("methodCallParameter") { @Override public boolean accepts(@NotNull final T literal, final ProcessingContext context) { final PsiElement parent = literal.getParent(); if (parent instanceof PsiExpressionList) { return hasIndex(literal, index) && checkCall(context, (PsiExpressionList)parent, methodPattern, nameCondition); } return false; } private boolean hasIndex(@NotNull T literal, int index) { int currentIndex = 0; PsiElement each = literal; while (each != null) { each = each.getPrevSibling(); if (each instanceof PsiExpression) { currentIndex++; if (currentIndex > index) return false; } } if (currentIndex != index) return false; return true; } }); }