@Nullable @Override @RequiredReadAction public ItemToShow[] getParametersForLookup(LookupElement item, ParameterInfoContext context) { Object object = item.getObject(); if(object instanceof DotNetLikeMethodDeclaration) { return new ItemToShow[]{new ItemToShow((CSharpSimpleLikeMethod) object, context.getFile())}; } if(object instanceof DotNetVariable) { DotNetVariable variable = (DotNetVariable) object; DotNetTypeRef dotNetTypeRef = variable.toTypeRef(tracksParameterIndex()); DotNetTypeResolveResult typeResolveResult = dotNetTypeRef.resolve(); if(typeResolveResult instanceof CSharpLambdaResolveResult) { return new ItemToShow[]{new ItemToShow((CSharpSimpleLikeMethod) typeResolveResult, variable)}; } } return ItemToShow.EMPTY_ARRAY; }
@Nullable private static DotNetGenericParameterListOwner findGenericParameterOwner(ParameterInfoContext context) { final PsiElement at = context.getFile().findElementAt(context.getEditor().getCaretModel().getOffset()); if(at == null) { return null; } DotNetTypeList typeList = PsiTreeUtil.getParentOfType(at, DotNetTypeList.class); if(typeList == null) { return null; } PsiElement parent = typeList.getParent(); if(!(parent instanceof CSharpReferenceExpression)) { return null; } int argumentsSize = DotNetPsiCountUtil.countChildrenOfType(typeList.getNode(), CSharpTokens.COMMA) + 1; CSharpReferenceExpression referenceExpression = (CSharpReferenceExpression) parent; ResolveResult[] resolveResults = referenceExpression.multiResolve(true); for(ResolveResult resolveResult : resolveResults) { PsiElement element = resolveResult.getElement(); if(element instanceof DotNetGenericParameterListOwner) { int genericParametersCount = ((DotNetGenericParameterListOwner) element).getGenericParametersCount(); if(genericParametersCount == argumentsSize) { return (DotNetGenericParameterListOwner) element; } } } return null; }
@Override public Object[] getParametersForLookup(final LookupElement item, final ParameterInfoContext context) { if(!(item instanceof MutableLookupElement)) { return null; } PsiElement element = item.getPsiElement(); if(element instanceof JSFunction) { final JSFunction originalFunction = (JSFunction) element; final List<JSFunction> lookupItems = new ArrayList<JSFunction>(); Set<String> availableSignatures = new HashSet<String>(); for(PsiElement el : DefinitionsScopedSearch.search(originalFunction)) { doAddSignature(lookupItems, availableSignatures, el); } if(lookupItems.size() == 0) { lookupItems.add(originalFunction); } return lookupItems.toArray(new Object[lookupItems.size()]); } return ArrayUtil.EMPTY_OBJECT_ARRAY; }
@Override public Object[] getParametersForDocumentation(final JSFunction p, final ParameterInfoContext context) { final JSParameterList list = p.getParameterList(); if(list != null) { return list.getParameters(); } return ArrayUtil.EMPTY_OBJECT_ARRAY; }
@Nullable private static VtlArgumentList findArgumentList(final ParameterInfoContext context) { final PsiFile file = context.getFile(); PsiDocumentManager.getInstance(file.getProject()).commitDocument(context.getEditor().getDocument()); final PsiElement elementAt = file.getViewProvider().findElementAt(context.getOffset(), VtlLanguage.INSTANCE); if (elementAt == null) { return null; } final VtlCallExpression call = PsiTreeUtil.getParentOfType(elementAt, VtlCallExpression.class); if (call == null) { return null; } return call.findArgumentList(); }
@Override public Object[] getParametersForDocumentation(final Object p, final ParameterInfoContext context) { if(p instanceof MethodCandidateInfo) { return ((MethodCandidateInfo) p).getElement().getParameterList().getParameters(); } if(p instanceof PsiMethod) { return ((PsiMethod) p).getParameterList().getParameters(); } return ArrayUtil.EMPTY_OBJECT_ARRAY; }
@Nullable @Override public Object[] getParametersForDocumentation(ItemToShow p, ParameterInfoContext context) { return new Object[0]; }
@Nullable @Override public Object[] getParametersForLookup(LookupElement item, ParameterInfoContext context) { return ArrayUtil.EMPTY_OBJECT_ARRAY; }
@Nullable @Override public Object[] getParametersForDocumentation(DotNetGenericParameterListOwner p, ParameterInfoContext context) { return ArrayUtil.EMPTY_OBJECT_ARRAY; }
@Nullable @Override public Object[] getParametersForDocumentation(Object p, ParameterInfoContext context) { return null; }
private XQueryArgumentList getArgumentList(ParameterInfoContext context) { PsiElement at = context.getFile().findElementAt(context.getOffset()); return PsiTreeUtil.getParentOfType(at, XQueryArgumentList.class); }
public Object[] getParametersForLookup(final LookupElement item, final ParameterInfoContext context) { //todo return null; }
public Object[] getParametersForDocumentation(final VtlCallable callable, final ParameterInfoContext context) { return new Object[]{callable}; }
@Override public Object[] getParametersForLookup(LookupElement item, ParameterInfoContext context) { final List<? extends PsiElement> elements = JavaCompletionUtil.getAllPsiElements(item); return elements != null && !elements.isEmpty() && elements.get(0) instanceof PsiMethod ? elements.toArray() : null; }