PsiType (@NotNull Editor editor, @NotNull PsiElement element) { if (element.getParent() instanceof PsiExpressionList && element.getParent().getParent() instanceof PsiMethodCallExpression) { PsiJavaToken leftBoundary = PsiTreeUtil.getPrevSiblingOfType(element, PsiJavaToken.class); PsiJavaToken rightBoundary = element instanceof PsiJavaToken ? (PsiJavaToken)element : PsiTreeUtil.getNextSiblingOfType(element, PsiJavaToken.class); if (leftBoundary != null && rightBoundary != null && CharArrayUtil.isEmptyOrSpaces(editor.getDocument().getImmutableCharSequence(), leftBoundary.getTextRange().getEndOffset(), rightBoundary.getTextRange().getStartOffset())) { PsiMethod method = CompletionMemory.getChosenMethod((PsiCall)element.getParent().getParent()); if (method != null) { List<PsiJavaToken> allTokens = PsiTreeUtil.getChildrenOfTypeAsList(element.getParent(), PsiJavaToken.class); PsiParameterList parameterList = method.getParameterList(); int parameterIndex = allTokens.indexOf(leftBoundary); if (parameterIndex >= 0 && parameterIndex < parameterList.getParametersCount()) { PsiParameter parameter = parameterList.getParameters()[parameterIndex]; return parameter.getType(); } } } } return null; }