public void showParameterInfo(@NotNull PsiElement element, CreateParameterInfoContext context) { ResolveResult[] variants = ResolveResult.EMPTY_ARRAY; if (element instanceof PsiPolyVariantReference) { variants = ((PsiPolyVariantReference) element).multiResolve(true); if (variants.length != 0) { context.setItemsToShow( ContainerUtil.map2Array( variants, CfmlFunctionDescription.class, new Function<ResolveResult, CfmlFunctionDescription>() { public CfmlFunctionDescription fun(ResolveResult resolveResult) { final PsiElement element1 = resolveResult.getElement(); if (CfmlPsiUtil.isFunctionDefinition(element1)) { CfmlFunction function = CfmlPsiUtil.getFunctionDefinition(element1); if (function != null) { return function.getFunctionInfo(); } } else if (element1 instanceof PsiMethod) { PsiMethod function = (PsiMethod) element1; CfmlFunctionDescription javaMethodDescr = new CfmlFunctionDescription( function.getName(), function.getReturnType().getPresentableText()); final PsiParameter[] psiParameters = function.getParameterList().getParameters(); final int paramsNum = psiParameters.length; for (int i = 0; i < paramsNum; i++) { PsiParameter psiParameter = psiParameters[i]; javaMethodDescr.addParameter( new CfmlFunctionDescription.CfmlParameterDescription( psiParameter.getName(), psiParameter.getType().getPresentableText(), true)); } return javaMethodDescr; } return null; } })); context.showHint(element, element.getTextRange().getStartOffset(), this); return; } } if (element instanceof CfmlReferenceExpression) { String functionName = element.getText().toLowerCase(); if (ArrayUtil.find( CfmlLangInfo.getInstance(element.getProject()).getPredefinedFunctionsLowCase(), functionName) != -1) { context.setItemsToShow( new Object[] { CfmlLangInfo.getInstance(element.getProject()) .getFunctionParameters() .get(functionName) }); context.showHint(element, element.getTextRange().getStartOffset(), this); } } }
@Override public void showParameterInfo(@NotNull PsiElement element, CreateParameterInfoContext context) { DartFunctionDescription functionDescription = null; if (element instanceof DartCallExpression) { functionDescription = DartFunctionDescription.tryGetDescription((DartCallExpression) element); } else if (element instanceof DartNewExpression) { final DartNewExpression newExpression = (DartNewExpression) element; final DartType type = newExpression.getType(); final DartClassResolveResult classResolveResult = DartResolveUtil.resolveClassByType(type); PsiElement psiElement = ((DartNewExpression) element).getReferenceExpression(); psiElement = psiElement == null && type != null ? type.getReferenceExpression() : psiElement; final PsiElement target = psiElement != null ? ((DartReference) psiElement).resolve() : null; if (target instanceof DartComponentName) { functionDescription = DartFunctionDescription.createDescription( (DartComponent) target.getParent(), classResolveResult); } } if (functionDescription != null && functionDescription.getParameters().length > 0) { context.setItemsToShow(new Object[] {functionDescription}); context.showHint(element, element.getTextRange().getStartOffset(), this); } }
@Override public void showParameterInfo( @NotNull JetValueArgumentList element, @NotNull CreateParameterInfoContext context) { context.showHint(element, element.getTextRange().getStartOffset(), this); }